diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b578d4b..d9c9478 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,22 +2,20 @@ name: Unit Test on: push: - branches: [ main, develop ] pull_request: - branches: [ main, develop ] + types: [synchronize, opened] env: CARGO_TERM_COLOR: always jobs: test: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Run unit tests - run: | - cargo test --verbose + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Run unit tests + run: | + cargo test --verbose diff --git a/.github/workflows/docker_build_push.yml b/.github/workflows/docker_build_push.yml index c3cba7b..7f96aa8 100644 --- a/.github/workflows/docker_build_push.yml +++ b/.github/workflows/docker_build_push.yml @@ -1,4 +1,4 @@ -name: Build and Publish Docker +name: Build and publish docker on: push: branches: @@ -6,8 +6,6 @@ on: - "main" tags: - "*.*.*" - pull_request: - types: [synchronize, opened] env: GHCR: ghcr.io diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a285aba..ec075c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,15 @@ -name: Extract executable binary and upload artifacts +name: Extract executable binary, upload artifacts, create release on: - push: - # workflow_run: - # workflows: - # - "Build and Publish Docker" - # - "Unit Test" - # types: - # - "completed" - # branches: - # - "main" - # - "develop" + workflow_run: + workflows: + - "Build and publish docker" + types: + - "completed" jobs: on-success: runs-on: ubuntu-latest - # if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event.workflow_run.conclusion == 'success' }} strategy: fail-fast: false matrix: @@ -75,13 +70,12 @@ jobs: steps: - run: "echo 'The relese triggering workflows passed'" - - name: "set env" - #if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="rpxy-nightly";else BUILD_NAME="rpxy";fi run: | if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi + if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="rpxy-nightly";else BUILD_NAME="rpxy";fi echo "PLATFORM_MAP=${PLATFORM_MAP}" >> $GITHUB_ENV - echo "TARGET_NAME=rpxy-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_ENV + echo "TARGET_NAME=${BUILD_NAME}-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_ENV - name: "docker pull and extract binary from docker image" id: "extract-binary" @@ -97,15 +91,15 @@ jobs: name: ${{ steps.extract-binary.outputs.artifact }} path: "/tmp/${{ steps.extract-binary.outputs.artifact }}" - # on-failure: - # runs-on: ubuntu-latest - # if: ${{ github.event.workflow_run.conclusion == 'failure' }} - # steps: - # - run: echo 'The release triggering workflows failed' + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'The release triggering workflows failed' release: runs-on: ubuntu-latest - # if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') needs: on-success steps: - name: checkout @@ -123,12 +117,12 @@ jobs: for i in ./*; do sh -c "cd $i && tar zcvf $i.tar.gz $i && mv $i.tar.gz /tmp/assets/"; done ls -lha /tmp/assets - # - name: release - # uses: softprops/action-gh-release@v1 - # if: startsWith(github.ref, 'refs/tags/') - # with: - # files: /tmp/assets/*.tar.gz - # tag_name: ${{ github.ref }} - # draft: true - # prerelease: false - # generate_release_notes: true + - name: release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: /tmp/assets/*.tar.gz + tag_name: ${{ github.ref }} + draft: true + prerelease: false + generate_release_notes: true