Repository navigation
feat(init): teach the next step and mark detected targets (#166) #181
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release-plz | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| release-plz-release: | |
| name: Release-plz release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| releases: ${{ steps.release-plz.outputs.releases }} | |
| releases_created: ${{ steps.release-plz.outputs.releases_created }} | |
| ion_tag: ${{ steps.extract.outputs.ion_tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run release-plz | |
| id: release-plz | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Extract release tags | |
| id: extract | |
| if: steps.release-plz.outputs.releases_created | |
| run: | | |
| echo '${{ steps.release-plz.outputs.releases }}' | jq -r '.[].tag' | while read tag; do | |
| if [[ "$tag" == ion-v* ]]; then | |
| echo "ion_tag=$tag" >> "$GITHUB_OUTPUT" | |
| fi | |
| done | |
| release-plz-pr: | |
| name: Release-plz PR | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: release-plz-${{ github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run release-plz | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release-pr | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| needs: release-plz-release | |
| if: needs.release-plz-release.outputs.ion_tag | |
| strategy: | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.release-plz-release.outputs.ion_tag }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tools | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package | |
| shell: bash | |
| run: | | |
| VERSION="${{ needs.release-plz-release.outputs.ion_tag }}" | |
| VERSION="${VERSION#ion-v}" | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../ion-${VERSION}-${{ matrix.target }}.tar.gz ion | |
| cd ../../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ion-${{ matrix.target }} | |
| path: ion-*.tar.gz | |
| upload: | |
| needs: [release-plz-release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Upload assets to release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: gh release upload "${{ needs.release-plz-release.outputs.ion_tag }}" ion-*.tar.gz --clobber |