Repository navigation
chore: Bump package version to 1.1.8 #12
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: Auto Tag and Release | |
| on: | |
| push: | |
| branches: [master, main] | |
| paths: | |
| - 'SkyPort/pubspec.yaml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: auto-tag-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| detect-version-change: | |
| name: Detect Version Change | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_tag: ${{ steps.version_check.outputs.should_tag }} | |
| new_version: ${{ steps.version_check.outputs.new_version }} | |
| tag_name: ${{ steps.version_check.outputs.tag_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Detect version change | |
| id: version_check | |
| run: | | |
| CURRENT_VERSION=$(sed -n 's/^[[:space:]]*version:[[:space:]]*\([^+]*\).*/\1/p' SkyPort/pubspec.yaml | head -n 1 | tr -d '\r') | |
| echo "Current version: $CURRENT_VERSION" | |
| PREV_VERSION=$(git show HEAD~1:SkyPort/pubspec.yaml 2>/dev/null | sed -n 's/^[[:space:]]*version:[[:space:]]*\([^+]*\).*/\1/p' | head -n 1 | tr -d '\r' || echo "") | |
| echo "Previous version: $PREV_VERSION" | |
| TAG_NAME="v${CURRENT_VERSION}" | |
| TAG_EXISTS=$(git tag -l "$TAG_NAME") | |
| echo "Tag exists check: $TAG_EXISTS" | |
| if [ -z "$CURRENT_VERSION" ]; then | |
| echo "No current version found" | |
| echo "should_tag=false" >> "$GITHUB_OUTPUT" | |
| elif [ -z "$PREV_VERSION" ]; then | |
| echo "No previous version found" | |
| echo "should_tag=false" >> "$GITHUB_OUTPUT" | |
| elif [ "$CURRENT_VERSION" = "$PREV_VERSION" ]; then | |
| echo "Version unchanged" | |
| echo "should_tag=false" >> "$GITHUB_OUTPUT" | |
| elif [ -n "$TAG_EXISTS" ]; then | |
| echo "Tag $TAG_NAME already exists, skipping" | |
| echo "should_tag=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version changed from $PREV_VERSION to $CURRENT_VERSION" | |
| echo "should_tag=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT" | |
| fi | |
| release-gate-tests: | |
| name: Release Gate Tests | |
| needs: detect-version-change | |
| if: needs.detect-version-change.outputs.should_tag == 'true' | |
| uses: ./.github/workflows/test.yml | |
| create-tag: | |
| name: Create Tag | |
| needs: [detect-version-change, build] | |
| if: needs.detect-version-change.outputs.should_tag == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create and push tag | |
| run: | | |
| TAG_NAME="${{ needs.detect-version-change.outputs.tag_name }}" | |
| VERSION="${{ needs.detect-version-change.outputs.new_version }}" | |
| echo "Creating tag: $TAG_NAME for version: $VERSION" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "$TAG_NAME" -m "Release $TAG_NAME | |
| Version: $VERSION | |
| Branch: ${{ github.ref_name }} | |
| Commit: ${{ github.sha }}" | |
| git push origin "$TAG_NAME" | |
| echo "Tag $TAG_NAME created and pushed" | |
| build: | |
| name: Build Release Artifacts | |
| needs: release-gate-tests | |
| uses: ./.github/workflows/build-matrix.yml | |
| with: | |
| retention-days: 30 | |
| release: | |
| name: Create GitHub Release | |
| needs: [detect-version-change, build, create-tag] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts | |
| pattern: '*' | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -R artifacts | |
| - name: Generate release notes | |
| env: | |
| TAG_NAME: ${{ needs.detect-version-change.outputs.tag_name }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: node .github/scripts/generate-release-notes.mjs "$TAG_NAME" release_notes.md artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ needs.detect-version-change.outputs.tag_name }} | |
| name: SkyPort ${{ needs.detect-version-change.outputs.tag_name }} | |
| body_path: release_notes.md | |
| files: artifacts/**/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |