Use one flow to handle multiple user decisions regarding skipping or … #613
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: "Main workflow" | |
on: push | |
jobs: | |
configure: | |
runs-on: ubuntu-latest | |
outputs: | |
uid_gid: ${{ steps.get-user.outputs.uid_gid }} | |
steps: | |
- id: get-user | |
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make | |
check_version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
exists: ${{ steps.get-version.outputs.exists }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- id: get-version | |
name: Get zxlib version | |
run: echo "version=$(./scripts/get_version.sh)" >> $GITHUB_OUTPUT | |
- id: tag-exists | |
name: Check if version exists | |
run: | | |
if git rev-parse ${{ steps.get-version.outputs.version }} >/dev/null 2>&1; then | |
echo "exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Fail if tag exists | |
if: ${{ steps.tag-exists.outputs.exists == 'true' }} | |
run: exit 1 | |
tag: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check_version | |
if: ${{ needs.check_version.outputs.exists != 'true' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.check_version.outputs.version }} |