diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml new file mode 100644 index 0000000..8e241b0 --- /dev/null +++ b/.github/workflows/build_artifacts.yml @@ -0,0 +1,79 @@ +name: Publish-Artifacts + +on: + push: + branches: + - main + pull_request: + +env: + CARGO_TERM_COLOR: always + REPO_APT_DEV_URL: https://repo.stackable.tech/repository/deb-dev + REPO_RPM_DEV_URL: https://repo.stackable.tech/repository/rpm-dev + +jobs: + debian10: + runs-on: debian10 + steps: + - uses: actions/checkout@v2 + - name: Change version if is PR + if: ${{ github.event_name == 'pull_request' }} + # We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically + # sorting packages by version. This means that when installing the package without specifying a version the + # nighly version is considered more current than mr versions and installed by default + run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-mr${{ github.event.number }}"/' Cargo.toml + - name: Build + run: ~/.cargo/bin/cargo +nightly build --verbose --release + - name: Build apt package + run: ~/.cargo/bin/cargo deb --manifest-path Cargo.toml --no-build + - name: Check workflow permissions + id: check_permissions + uses: scherermichael-oss/action-has-permission@1.0.6 + with: + required-permission: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish apt package + if: steps.check_permissions.outputs.has-permission + run: >- + /usr/bin/curl + --fail + -u 'github:${{ secrets.NEXUS_PASSWORD }}' + -H "Content-Type: multipart/form-data" + --data-binary "@./$(find target/debian/ -name *.deb)" + "${{ env.REPO_APT_DEV_URL }}/" + - name: Clean + run: ~/.cargo/bin/cargo clean + + centos: + runs-on: centos${{ matrix.node }} + strategy: + matrix: + node: [ 7, 8 ] + steps: + - uses: actions/checkout@v2 + - name: Change version if is PR + if: ${{ github.event_name == 'pull_request' }} + # We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically + # sorting packages by version. This means that when installing the package without specifying a version the + # nighly version is considered more current than mr versions and installed by default + run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-pr${{ github.event.number }}"/' Cargo.toml + - name: Build + run: ~/.cargo/bin/cargo +nightly build --verbose --release + - name: Build RPM package + run: packaging/buildrpm.sh stackable-agent + - name: Check workflow permissions + id: check_permissions + uses: scherermichael-oss/action-has-permission@1.0.6 + with: + required-permission: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish RPM package + if: steps.check_permissions.outputs.has-permission + run: >- + /usr/bin/curl + --fail + -u 'github:${{ secrets.NEXUS_PASSWORD }}' + --upload-file "./$(find target/rpm/RPMS/x86_64/ -name *.rpm)" + "${{ env.REPO_RPM_DEV_URL }}/el${{ matrix.node }}/" \ No newline at end of file diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 8a3fd00..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Publish-Nightly-Packages - -on: - push: - branches: - - main - -env: - CARGO_TERM_COLOR: always - -jobs: - debian10: - runs-on: debian10 - steps: - - uses: actions/checkout@v2.3.4 - - name: Build - run: ~/.cargo/bin/cargo +nightly build --verbose --release - - name: Build apt package - run: ~/.cargo/bin/cargo deb --no-build - - name: Publish apt package - run: >- - /usr/bin/curl - --fail - -u 'github:${{ secrets.NEXUS_PASSWORD }}' - -H "Content-Type: multipart/form-data" - --data-binary "@./$(find target/debian/ -name *.deb)" - "https://repo.stackable.tech/repository/deb-nightly/" - - centos: - runs-on: centos${{ matrix.node }} - strategy: - matrix: - node: [ 7, 8 ] - steps: - - uses: actions/checkout@v2.3.4 - - name: Build - run: ~/.cargo/bin/cargo +nightly build --verbose --release - - name: Build RPM package - run: packaging/buildrpm.sh stackable-agent - - name: Publish RPM package - run: >- - /usr/bin/curl - --fail - -u 'github:${{ secrets.NEXUS_PASSWORD }}' - --upload-file "./$(find target/rpm/RPMS/x86_64/ -name *.rpm)" - "https://repo.stackable.tech/repository/rpm-nightly/el${{ matrix.node }}/"