Update samples #26
Workflow file for this run
This file contains hidden or 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: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: read | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.set_version.outputs.version }} | |
| tag_name: ${{ steps.set_version.outputs.tag_name }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set build version | |
| id: set_version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| last_tag=$(git tag --list 'v*' --sort=-v:refname | head -n 1) | |
| if [ -z "$last_tag" ]; then | |
| version="0.0.1" | |
| else | |
| raw=${last_tag#v} | |
| IFS='.' read -r major minor patch <<< "$raw" | |
| if [ -n "$major" ] && [ -n "$minor" ] && [ -n "$patch" ]; then | |
| patch=$((patch + 1)) | |
| version="$major.$minor.$patch" | |
| else | |
| version="$raw.1" | |
| fi | |
| fi | |
| else | |
| version="${{ github.ref_name }}" | |
| version=${version#v} | |
| fi | |
| tag_name="v$version" | |
| echo "VERSION=$version" >> "$GITHUB_ENV" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT" | |
| - name: Create tag for manual run | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| shell: bash | |
| run: | | |
| tag="v$VERSION" | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then | |
| echo "Tag $tag already exists." | |
| else | |
| git tag "$tag" | |
| git push origin "$tag" | |
| fi | |
| build_windows: | |
| needs: prepare | |
| uses: ./.github/workflows/build-window.yml | |
| secrets: inherit | |
| with: | |
| version: ${{ needs.prepare.outputs.version }} | |
| release: | |
| needs: | |
| - prepare | |
| - build_windows | |
| uses: ./.github/workflows/create-release.yml | |
| with: | |
| tag_name: ${{ needs.prepare.outputs.tag_name }} | |
| artifact_name: build-* |