diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dba73fd..8e3b43bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,5 @@ name: CD on: - workflow_run: - workflows: - - CI - branches: [main, beta] - types: - - completed schedule: - cron: 0 1 * * * # every night at 1am on dev workflow_dispatch: @@ -18,14 +12,12 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WIN_CSC_LINK: ${{ github.workspace }}/certwin.p12 CSC_LINK: ${{ github.workspace }}/certmac.p12 - GITHUB_REF_OVERRIDE: ${{ github.event.workflow_run.conclusion == 'success' && format('refs/heads/{0}', github.event.workflow_run.head_branch) || github.ref }} jobs: compile: name: Compile runs-on: ubuntu-latest - if: "${{ github.event.workflow_run.conclusion == 'success' }} - || ${{ github.event_name == 'schedule'}} + if: "${{ github.event_name == 'schedule'}} || (${{ github.event_name == 'workflow_dispatch' }} && contains('refs/heads/main,refs/heads/beta,refs/heads/dev', github.ref))" outputs: current-version: ${{ steps.compile.outputs.current-version }} @@ -35,7 +27,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ env.GITHUB_REF_OVERRIDE }} - name: Decode certificates env: WIN_CSC_LINK_RAW: ${{ secrets.WIN_CSC_LINK }} @@ -89,7 +80,6 @@ jobs: export PATH="$(pwd)/.github/bin/:$PATH" # override because of "env-ci" used by semantic-release # GITHUB_REF should not be default branch when "workflow_run" event is triggered - export GITHUB_REF=$GITHUB_REF_OVERRIDE echo "current-version=$(node -e "console.log(require('./package.json').version)")" >> $GITHUB_OUTPUT yarn semantic-release echo "next-version=$(node -e "console.log(require('./package.json').version)")" >> $GITHUB_OUTPUT @@ -144,7 +134,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ env.GITHUB_REF_OVERRIDE }} - name: Setup Node uses: ./.github/actions/setup-node - name: Yarn install @@ -189,7 +178,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ env.GITHUB_REF_OVERRIDE }} - name: Download all dist form build jobs uses: actions/download-artifact@v2 with: @@ -216,5 +204,4 @@ jobs: - name: Semantic Release run: | export PATH="$(pwd)/.github/bin/:$PATH" - export GITHUB_REF=$GITHUB_REF_OVERRIDE yarn semantic-release