diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5da993..9e22599 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,23 @@ name: CI on: [push, pull_request, workflow_dispatch] jobs: + pre_job: + # continue-on-error: true # Uncomment once integration is finished + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + # All of these options are optional, so you can remove them if you are happy with the defaults + concurrent_skipping: 'same_content_newer' + skip_after_successful_duplicate: 'false' + native: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' name: native runs-on: ${{ matrix.os }} strategy: @@ -69,6 +85,8 @@ jobs: name: release-${{ matrix.os }} path: "target/release/neolink*" cross: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' name: cross runs-on: ubuntu-latest container: "node:current-bullseye-slim" @@ -134,16 +152,15 @@ jobs: TARGET: ${{ matrix.target }} - uses: actions/upload-artifact@v3 with: - name: release-${{ matrix.arch }}-buster + name: release-${{ matrix.arch }}-bullseye path: "target/${{ matrix.target }}/release/neolink*" push_to_registry: name: Build Docker image - if: github.event_name == 'push' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest needs: - "cross" - - "native" steps: - name: Check token is set id: vars @@ -186,11 +203,13 @@ jobs: shell: bash run: | tags="" - if [[ "${GITHUB_REF}" =~ ^'refs/tags/'(.*) ]]; then - gittag="$(echo "${BASH_REMATCH[1]}" | sed -E 's|[/]|-|g')" + gittag="$(git tag --points-at HEAD)" + branch="$)git rev-parse --abbrev-ref HEAD)" + + if [[ -n "${gittag}" ]]; then tags="${REPO_NAME}:${gittag}" - elif [[ "${GITHUB_REF}" =~ ^'refs/heads/'(.*) ]]; then - branch="$(echo "${BASH_REMATCH[1]}" | sed -E 's|[/]|-|g')" + elif [[ -n "${branch}" ]]; then + branch="$(echo "${branch}" | sed -E 's|[/]|-|g')" tags="${REPO_NAME}:${branch}" if [ "${branch}" == "master" ]; then tags="${tags},${REPO_NAME}:latest" @@ -218,22 +237,22 @@ jobs: - name: Download Linux x86_64 uses: actions/download-artifact@v3 with: - name: release-amd64-buster + name: release-amd64-bullseye path: linux/amd64 - name: Download Linux armv7 uses: actions/download-artifact@v3 with: - name: release-armhf-buster + name: release-armhf-bullseye path: linux/arm/v7 - name: Download Linux arm64 uses: actions/download-artifact@v3 with: - name: release-arm64-buster + name: release-arm64-bullseye path: linux/arm64 - name: Download Linux i386 uses: actions/download-artifact@v3 with: - name: release-i386-buster + name: release-i386-bullseye path: linux/386 - name: Push to Docker Hub if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} @@ -287,22 +306,22 @@ jobs: - name: Download Linux x86_64 uses: actions/download-artifact@v3 with: - name: release-amd64-buster - path: neolink_linux_x86_64_buster + name: release-amd64-bullseye + path: neolink_linux_x86_64_bullseye - name: Download Linux armhf uses: actions/download-artifact@v3 with: - name: release-armhf-buster + name: release-armhf-bbullseye path: neolink_linux_armhf - name: Download Linux arm64 uses: actions/download-artifact@v3 with: - name: release-arm64-buster + name: release-arm64-bullseye path: neolink_linux_arm64 - name: Download Linux i386 uses: actions/download-artifact@v3 with: - name: release-i386-buster + name: release-i386-bullseye path: neolink_linux_i386 - name: Prepare Releases run: | @@ -310,7 +329,7 @@ jobs: neolink_windows neolink_macos neolink_linux_x86_64_ubuntu - neolink_linux_x86_64_buster + neolink_linux_x86_64_bullseye neolink_linux_armhf neolink_linux_arm64 neolink_linux_i386 @@ -327,7 +346,7 @@ jobs: neolink_windows.zip neolink_macos.zip neolink_linux_x86_64_ubuntu.zip - neolink_linux_x86_64_buster.zip + neolink_linux_x86_64_bullseye.zip neolink_linux_armhf.zip neolink_linux_arm64.zip neolink_linux_i386.zip