ci: change deploy workflows to workflow_call #13
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }}T | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: linux-x64 | |
| artifact: simutil-linux-x64 | |
| - os: macos-latest | |
| target: macos-x64 | |
| artifact: simutil-macos-x64 | |
| - os: macos-14 | |
| target: macos-arm64 | |
| artifact: simutil-macos-arm64 | |
| - os: windows-latest | |
| target: windows-x64 | |
| artifact: simutil-windows-x64.exe | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Build executable | |
| run: dart compile exe bin/simutil.dart -o ${{ matrix.artifact }} | |
| - name: Create archive (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| chmod +x ${{ matrix.artifact }} | |
| tar -czvf simutil-${{ matrix.target }}.tar.gz ${{ matrix.artifact }} | |
| - name: Create archive (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| Compress-Archive -Path ${{ matrix.artifact }} -DestinationPath simutil-${{ matrix.target }}.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: simutil-${{ matrix.target }} | |
| path: simutil-${{ matrix.target }}.${{ runner.os == 'Windows' && 'zip' || 'tar.gz' }} | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| find . -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec mv {} . \; | |
| sha256sum *.tar.gz *.zip > checksums.txt | |
| cat checksums.txt | |
| - name: Extract changelog | |
| id: changelog | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| CHANGELOG=$(awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md) | |
| echo "content<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body: ${{ steps.changelog.outputs.content }} | |
| generate_release_notes: true | |
| files: | | |
| artifacts/*.tar.gz | |
| artifacts/*.zip | |
| artifacts/checksums.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| deploy-pub-dev: | |
| name: Deploy to pub.dev | |
| needs: release | |
| uses: ./.github/workflows/deploy-pub-dev.yaml | |
| secrets: inherit | |
| deploy-homebrew: | |
| name: Deploy to Homebrew | |
| needs: release | |
| uses: ./.github/workflows/deploy-homebrew.yaml | |
| secrets: inherit | |
| deploy-winget: | |
| name: Deploy to WinGet | |
| needs: release | |
| uses: ./.github/workflows/deploy-winget.yaml | |
| secrets: inherit |