更新版本号到a33 #39
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 | |
| packages: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| full-version: ${{ steps.version.outputs.full-version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Extract version from tag | |
| run: | | |
| echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV" | |
| - name: Build and package | |
| run: ./gradlew :core:distZip :core:distTar | |
| - name: Export full version | |
| id: version | |
| run: echo "full-version=$(grep '^version=' build/generated/version/version.properties | cut -d= -f2)" >> "$GITHUB_OUTPUT" | |
| - name: Install build dependencies | |
| run: sudo apt-get update -y && sudo apt-get install -y libcjson-dev | |
| - name: Build .deb package | |
| run: ./gradlew buildDeb | |
| - name: Publish api to GitHub Packages | |
| run: ./gradlew :api:publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| run: | | |
| gh release create "v$VERSION" \ | |
| --title "AutoTweaker v$VERSION" \ | |
| --generate-notes \ | |
| core/build/distributions/*.zip \ | |
| core/build/distributions/*.tar \ | |
| .temp/deb/*.deb | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| update-index: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract version from tag | |
| run: | | |
| echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV" | |
| - name: Install PyYAML | |
| run: pip3 install pyyaml | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.WEBSITE_DEPLOY_KEY }}" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hosts | |
| - name: Clone index repository | |
| run: git clone git@github.com:AutoTweaker/index.git .temp/index | |
| env: | |
| GIT_SSH_COMMAND: ssh -i ~/.ssh/deploy_key | |
| - name: Configure git | |
| working-directory: .temp/index | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Merge release assets into index | |
| working-directory: .temp/index | |
| run: | | |
| gh release view "v${VERSION}" --repo AutoTweaker/core --json assets \ | |
| | python3 ../../scripts/merge-index.py ../../index.yml index.json "${{ needs.release.outputs.full-version }}" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Push index update | |
| working-directory: .temp/index | |
| run: | | |
| git add index.json | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update core to v${VERSION}" | |
| git push origin main | |
| fi | |
| env: | |
| GIT_SSH_COMMAND: ssh -i ~/.ssh/deploy_key |