Skip to content

Commit

Permalink
chore(ci): separate job for release-please and version compute
Browse files Browse the repository at this point in the history
  • Loading branch information
codito authored Oct 12, 2024
1 parent f5049b9 commit 0e10219
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,48 @@ on:
branches: [master]
pull_request:
branches: [master]
types: [closed]

# Required by release-please
permissions:
contents: write
pull-requests: write

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: googleapis/release-please-action@v4
id: release
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
- name: Default build version
- name: Set default build number
run: |
# https://stackoverflow.com/questions/8653126/how-to-increment-version-number-in-a-shell-script
BUILD_VERSION=$(cat version.txt | awk -F. -v OFS=. '{$NF=$NF+1;print}')-pre.${{ github.run_number }}
echo "APP_BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_ENV
- name: Release build version
- name: Update build number
if: ${{ steps.release.outputs.release_created }}
run: |
RELEASE_VERSION=${{ steps.release.outputs.tag_name }}
echo "APP_BUILD_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
- name: Show build version
- name: Final build version
run: |
echo ${{ env.APP_BUILD_VERSION }}
outputs:
build_version: ${{ env.APP_BUILD_VERSION }}
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: [version]
env:
APP_BUILD_VERSION: ${{ needs.version.build_version }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
Expand Down

0 comments on commit 0e10219

Please sign in to comment.