diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c83020e..3c74ef3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: env: - tag_name: ${{ github.ref_name }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: build: @@ -43,7 +43,7 @@ jobs: - name: Ensure version is equal to tag if: startsWith(github.ref, 'refs/tags/') run: | - [ "${{ env.game_version }}" == "${{ env.tag_name }}" ] || exit 2 + [ "${{ env.game_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2 - name: Export Marble uses: ./.github/actions/export-game @@ -62,12 +62,12 @@ jobs: # Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail. - name: Install rsync - if: ${{ matrix.platform == 'web' }} + if: ${{ (matrix.platform == 'web') && (env.BRANCH_NAME == 'main') }} run: | apt-get update && apt-get install -y rsync - name: Deploy to GitHub Pages - if: ${{ matrix.platform == 'web' }} + if: ${{ (matrix.platform == 'web') && (env.BRANCH_NAME == 'main') }} uses: JamesIves/github-pages-deploy-action@v4 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c86529c..21cc3ac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: types: [completed] env: - head_branch: ${{ github.event.workflow_run.head_branch }} + BRANCH_NAME: ${{ github.event.workflow_run.head_branch }} jobs: set_tag_name: @@ -18,8 +18,8 @@ jobs: steps: - name: Check Tag run: | - if [[ ${{ env.head_branch }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "tag_name=${{ env.head_branch }}" >> "$GITHUB_ENV" + if [[ ${{ env.BRANCH_NAME }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "tag_name=${{ env.BRANCH_NAME }}" >> "$GITHUB_ENV" else echo "tag_name=null" >> "$GITHUB_ENV" fi