fix(cd): publish only for tag #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [4.x] | |
tags: ['*'] | |
workflow_dispatch: | |
env: | |
tag_name: ${{ github.ref_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: windows | |
preset: Windows Desktop | |
- platform: linux | |
preset: Linux/X11 | |
# - platform: web | |
# preset: Web | |
- platform: mac | |
preset: macOS | |
name: ${{ matrix.preset }} Export | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Versions Vars | |
run: | | |
echo "game_version=$(cat .version)" >> $GITHUB_ENV | |
echo "godot_version=$(cat .godot_version)" >> $GITHUB_ENV | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Bump Version | |
run: | | |
pip install git+https://github.com/MechanicalFlower/backpack.git | |
bump_version --version-file .version --cfg-file export_presets.cfg | |
- name: Ensure version is equal to tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
[ "${{ env.game_version }}" == "${{ env.tag_name }}" ] || exit 2 | |
- name: Export Greeter | |
uses: ./.github/actions/export-game | |
with: | |
name: Greeter | |
platform: ${{ matrix.platform }} | |
preset: ${{ matrix.preset }} | |
version: ${{ env.game_version }} | |
godot_version: ${{ env.godot_version }} | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
with: | |
name: Greeter-${{ matrix.platform }}-v${{ env.game_version }} | |
path: build/${{ matrix.platform }} | |
# Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail. | |
- name: Install rsync | |
if: ${{ matrix.platform == 'web' }} | |
run: | | |
apt-get update && apt-get install -y rsync | |
- name: Deploy to GitHub Pages | |
if: ${{ matrix.platform == 'web' }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: build/web |