From 067bb07ddbe0cdc4b75ad5b566d3c65ed6e2b224 Mon Sep 17 00:00:00 2001 From: simonsan <14062932+simonsan@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:56:34 +0100 Subject: [PATCH] ci: remove release workflow and fix release continuous deployment Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> --- .github/workflows/release-cd.yml | 127 +++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 122 ----------------------------- 2 files changed, 127 insertions(+), 122 deletions(-) create mode 100644 .github/workflows/release-cd.yml delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release-cd.yml b/.github/workflows/release-cd.yml new file mode 100644 index 000000000..56d08f5b9 --- /dev/null +++ b/.github/workflows/release-cd.yml @@ -0,0 +1,127 @@ +name: Continuous Deployment (Release) + +on: + push: + branches: + - main + +defaults: + run: + shell: bash + +permissions: + contents: write + discussions: write + +env: + BINARY_NAME: rustic + BINARY_NIGHTLY_DIR: rustic + +jobs: + publish: + if: ${{ github.repository_owner == 'rustic-rs' && github.ref == 'refs/tags/' }} + name: Publishing ${{ matrix.job.target }} + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + rust: [stable] + job: + - os: windows-latest + os-name: windows + target: x86_64-pc-windows-msvc + architecture: x86_64 + binary-postfix: ".exe" + use-cross: false + - os: windows-latest + os-name: windows + target: x86_64-pc-windows-gnu + architecture: x86_64 + binary-postfix: ".exe" + use-cross: false + - os: macos-latest + os-name: macos + target: x86_64-apple-darwin + architecture: x86_64 + binary-postfix: "" + use-cross: false + - os: macos-latest + os-name: macos + target: aarch64-apple-darwin + architecture: arm64 + binary-postfix: "" + use-cross: true + - os: ubuntu-latest + os-name: linux + target: x86_64-unknown-linux-gnu + architecture: x86_64 + binary-postfix: "" + use-cross: false + - os: ubuntu-latest + os-name: linux + target: x86_64-unknown-linux-musl + architecture: x86_64 + binary-postfix: "" + use-cross: false + - os: ubuntu-latest + os-name: linux + target: aarch64-unknown-linux-gnu + architecture: arm64 + binary-postfix: "" + use-cross: true + - os: ubuntu-latest + os-name: linux + target: i686-unknown-linux-gnu + architecture: i686 + binary-postfix: "" + use-cross: true + # TODO!: This needs a fix, linking `execinfo` fails + # - os: ubuntu-latest + # os-name: netbsd + # target: x86_64-unknown-netbsd + # architecture: x86_64 + # binary-postfix: "" + # use-cross: true + - os: ubuntu-latest + os-name: linux + target: armv7-unknown-linux-gnueabihf + architecture: armv7 + binary-postfix: "" + use-cross: true + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + fetch-depth: 0 # fetch all history so that git describe works + - name: Create binary artifact + uses: rustic-rs/create-binary-artifact-action@main # dev + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.job.target }} + use-cross: ${{ matrix.job.use-cross }} + binary-postfix: ${{ matrix.job.binary-postfix }} + os: ${{ runner.os }} + binary-name: ${{ env.BINARY_NAME }} + package-secondary-name: ${{ matrix.job.target}} + github-token: ${{ secrets.GITHUB_TOKEN }} + gpg-release-private-key: ${{ secrets.GPG_RELEASE_PRIVATE_KEY }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} + rsign-release-private-key: ${{ secrets.RSIGN_RELEASE_PRIVATE_KEY }} + rsign-passphrase: ${{ secrets.RSIGN_PASSPHRASE }} + github-ref: ${{ github.ref }} + sign-release: true + hash-release: true + use-project-version: true + + - name: Creating Release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 + with: + discussion_category_name: "Announcements" + draft: true + body_path: ${{ github.workspace }}/CHANGELOG.md + fail_on_unmatched_files: true + files: | + binary-*/** + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 830268c47..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,122 +0,0 @@ -on: - push: - -name: Build release binaries - -jobs: - publish: - if: startsWith(github.ref, 'refs/tags/') - name: Publishing ${{ matrix.job.target }} - runs-on: ${{ matrix.job.os }} - strategy: - matrix: - rust: [stable] - job: - - os: windows-latest - os-name: windows - target: x86_64-pc-windows-msvc - architecture: x86_64 - binary-postfix: "" - use-cross: false - - os: macos-latest - os-name: macos - target: x86_64-apple-darwin - architecture: x86_64 - binary-postfix: "" - use-cross: false - - os: macos-latest - os-name: macos - target: aarch64-apple-darwin - architecture: arm64 - binary-postfix: "" - use-cross: true - - os: ubuntu-latest - os-name: linux - target: x86_64-unknown-linux-gnu - architecture: x86_64 - binary-postfix: "" - use-cross: false - - os: ubuntu-latest - os-name: linux - target: x86_64-unknown-linux-musl - architecture: x86_64 - binary-postfix: "" - use-cross: false - - os: ubuntu-latest - os-name: linux - target: aarch64-unknown-linux-gnu - architecture: arm64 - binary-postfix: "" - use-cross: true - - os: ubuntu-latest - os-name: linux - target: i686-unknown-linux-gnu - architecture: i686 - binary-postfix: "" - use-cross: true - - os: ubuntu-latest - os-name: netbsd - target: x86_64-unknown-netbsd - architecture: x86_64 - binary-postfix: "" - use-cross: true - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - with: - fetch-depth: 0 - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1 - with: - toolchain: ${{ matrix.rust }} - targets: ${{ matrix.job.target }} - - name: install compiler - shell: bash - run: | - if [[ ${{ matrix.job.target }} == x86_64-unknown-linux-musl ]]; then - sudo apt update - sudo apt-get install -y musl-tools - fi - - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 - with: - key: ${{ matrix.job.target }} - - name: Set Version - shell: bash - run: echo "PROJECT_VERSION=$(git describe --tags)" >> $GITHUB_ENV - - name: Cargo build - uses: ClementTsang/cargo-action@a211c79cf22973eb590277586fbea20269ca3ca0 # v0 (attention: this should be double checked for security issues) - with: - command: build - use-cross: ${{ matrix.job.use-cross }} - toolchain: ${{ matrix.rust }} - args: --release --target ${{ matrix.job.target }} - - - name: Packaging final binary - if: ${{ !contains(github.ref_name, '/') }} - shell: bash - run: | - cd target/${{ matrix.job.target }}/release - - ########## create tar.gz ########## - RELEASE_NAME=rustic-${{ github.ref_name }}-${{ matrix.job.target}} - tar czvf $RELEASE_NAME.tar.gz rustic${{ matrix.job.binary-postfix }} - - ########## create sha256 ########## - if [[ ${{ runner.os }} == 'Windows' ]]; then - certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 - else - shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 - fi - - name: Storing binary as artefact - uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4 - with: - name: binary-${{ matrix.job.target}} - path: target/${{ matrix.job.target }}/release/rustic-${{ github.ref_name }}-${{ matrix.job.target}}.tar.gz - - name: Releasing release versions - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 - with: - files: | - target/${{ matrix.job.target }}/release/rustic-*.tar.gz - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}