name: Publish on: push: tags: - "*" release: jobs: binary: name: Publish ${{ matrix.target }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: macos-latest target: x86_64-apple-darwin - os: ubuntu-latest target: x86_64-unknown-linux-musl - os: ubuntu-latest target: x86_64-pc-windows-gnu - os: ubuntu-latest target: armv7-unknown-linux-musleabihf - os: ubuntu-latest target: armv7-linux-androideabi - os: ubuntu-latest target: aarch64-linux-android - os: ubuntu-latest target: aarch64-unknown-linux-gnu - os: macos-latest target: aarch64-apple-darwin steps: ### We're checking out the repository at the triggered ref - uses: actions/checkout@v4 - name: Get the version id: get_version run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - name: Check if release exists id: check_release run: | if gh release view ${{ steps.get_version.outputs.VERSION }} > /dev/null 2>&1; then echo "RELEASE_EXISTS=true" >> $GITHUB_OUTPUT else echo "RELEASE_EXISTS=false" >> $GITHUB_OUTPUT fi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create release continue-on-error: true if: steps.check_release.outputs.RELEASE_EXISTS == 'false' run: | gh release create ${{ steps.get_version.outputs.VERSION }} \ --title "Release ${{ steps.get_version.outputs.VERSION }}" \ --notes "Release notes for ${{ steps.get_version.outputs.VERSION }}" \ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build id: build run: scripts/release ${{ matrix.target }} - name: Upload binaries to release run: | cd ./target/${{ matrix.target }}/release/ cp navi.${{ steps.build.outputs.EXTENSION }} navi-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.${{ steps.build.outputs.EXTENSION }} gh release upload ${{ steps.get_version.outputs.VERSION }} navi-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.${{ steps.build.outputs.EXTENSION }} env: GH_TOKEN: ${{ github.token }}