|
16 | 16 | - name: Checkout |
17 | 17 | uses: actions/checkout@v4 |
18 | 18 | with: |
19 | | - # Make sure the release step uses its own credentials: |
20 | | - # https://github.com/cycjimmy/semantic-release-action#private-packages |
21 | 19 | persist-credentials: false |
22 | 20 | fetch-depth: 0 |
23 | 21 |
|
@@ -46,13 +44,45 @@ jobs: |
46 | 44 | fingerprint: ${{ env.GPG_FINGERPRINT }} |
47 | 45 |
|
48 | 46 | - name: Release |
49 | | - id: semantic_release |
| 47 | + id: semantic_release |
50 | 48 | env: |
51 | 49 | GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }} |
52 | | - run: npm exec semantic-release |
53 | | - |
54 | | - - name: Call Update Bundle Workflow |
55 | | - if: github.ref == 'refs/heads/main' # Check if the branch is main |
56 | | - uses: ./.github/workflows/update-bundle.yml # Path to the update-bundle workflow |
| 50 | + run: | |
| 51 | + output=$(npm exec semantic-release) |
| 52 | + echo "$output" |
| 53 | + version=$(echo "$output" | grep -oP '(?<=Published version: )\d+\.\d+\.\d+') |
| 54 | + echo "::set-output name=version::$version" |
| 55 | +
|
| 56 | + - name: Update Bundle |
| 57 | + if: startsWith(github.ref, 'refs/heads/main') # Safer condition |
| 58 | + run: | |
| 59 | + version=${{ steps.semantic_release.outputs.version }} |
| 60 | + patches_asset_url="https://github.com/indrastorms/Dropped-Patches/releases/latest/download/patches-${version}.rvp" |
| 61 | + signature_download_url="https://github.com/indrastorms/Dropped-Patches/releases/latest/download/patches-${version}.rvp.asc" |
| 62 | + |
| 63 | + info_dict=$(cat <<EOF |
| 64 | + { |
| 65 | + "created_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", |
| 66 | + "description": "Release version ${version}", |
| 67 | + "download_url": "${patches_asset_url}", |
| 68 | + "signature_download_url": "${signature_download_url}", |
| 69 | + "version": "${version}" |
| 70 | + } |
| 71 | + EOF |
| 72 | + ) |
| 73 | +
|
| 74 | + echo "bundle_file=dropped-patches-bundle.json" >> $GITHUB_ENV |
| 75 | + echo "$info_dict" > "${{ env.bundle_file }}" |
| 76 | + echo "Latest release information saved to ${{ env.bundle_file }}" |
| 77 | +
|
| 78 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 79 | + git config --local user.name "github-actions[bot]" |
| 80 | + git add ${{ env.bundle_file }} |
| 81 | + git commit -m "update ${{ env.bundle_file }} [skip ci]" |
| 82 | +
|
| 83 | + - name: Push changes |
| 84 | + if: startsWith(github.ref, 'refs/heads/main') # Ensure this matches the main branch condition |
| 85 | + uses: ad-m/github-push-action@master |
57 | 86 | with: |
58 | | - version: ${{ steps.semantic_release.outputs.version }} # Pass the version output |
| 87 | + github_token: ${{ secrets.GIT_TOKEN }} |
| 88 | + branch: main |
0 commit comments