Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit eaf94a5

Browse files
authored
refactor: Migrate to release via a PR (#2810)
1 parent 1cce2ab commit eaf94a5

File tree

1 file changed

+46
-50
lines changed

1 file changed

+46
-50
lines changed

Diff for: .github/workflows/release.yml

+46-50
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- develop
8-
workflow_dispatch:
7+
- refactor/release
98

109
jobs:
1110
prepare:
@@ -15,6 +14,9 @@ jobs:
1514
strategy:
1615
matrix:
1716
lambda: ["modules/webhook/lambdas/webhook", "modules/runner-binaries-syncer/lambdas/runner-binaries-syncer", "modules/runners/lambdas/runners"]
17+
permissions:
18+
contents: read
19+
actions: write
1820
steps:
1921
- name: Extract lambda name
2022
id: lambda
@@ -38,65 +40,59 @@ jobs:
3840
runs-on: ubuntu-latest
3941
needs:
4042
prepare
43+
outputs:
44+
upload_url: ${{ steps.release.outputs.upload_url }}
45+
releases_created: ${{ steps.release.outputs.releases_created }}
46+
permissions:
47+
contents: write
48+
issues: write
49+
pull-requests: write
50+
actions: write
4151
steps:
42-
- uses: actions/checkout@v3
43-
with:
44-
fetch-depth: 0
45-
persist-credentials: false
46-
- uses: actions/download-artifact@v3
47-
with:
48-
name: webhook
49-
path: artifacts
50-
- uses: actions/download-artifact@v3
51-
with:
52-
name: runners
53-
path: artifacts
54-
- uses: actions/download-artifact@v3
55-
with:
56-
name: runner-binaries-syncer
57-
path: artifacts
58-
5952
- name: Get installation token
6053
uses: npalm/[email protected]
61-
id: app-token
54+
id: token
6255
with:
6356
appId: ${{ secrets.FOREST_RELEASER_APP_ID }}
6457
appPrivateKeyBase64: ${{ secrets.FOREST_RELEASER_APP_PRIVATE_KEY_BASE64 }}
6558
appInstallationType: repo
6659
appInstallationValue: ${{ github.repository }}
6760

68-
- name: Dry run release
69-
if: github.event_name != 'pull_request'
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Read only token
72-
run: |
73-
cp .release/* .
74-
yarn
75-
yarn release -d --repositoryUrl https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git
76-
61+
# bootstrap-sha and release-as needs to be removed after first release
7762
- name: Release
78-
if: github.event_name != 'pull_request' && contains('refs/heads/main', github.ref)
79-
env:
80-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
81-
run: |
82-
cp .release/* .
83-
yarn
84-
yarn release --repositoryUrl https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git
85-
86-
provenance:
87-
name: Generate provenance
88-
runs-on: ubuntu-20.04
89-
needs:
90-
release
91-
if: startsWith(github.ref, 'refs/tags/')
63+
id: release
64+
uses: google-github-actions/release-please-action@5c07f8be172b1f6e90f9c35baf8184461b91b85f # ratchet:google-github-actions/release-please-action@v3
65+
with:
66+
default-branch: main
67+
release-type: terraform-module
68+
token: ${{ steps.token.outputs.token }}
69+
last-release-sha: b404332ff8b401a5a8958317a69b9f849b794a16
70+
71+
assets:
72+
name: upload assets
73+
if: ${{ needs.release.outputs.releases_created }}
74+
needs: release
75+
runs-on: ubuntu-latest
76+
strategy:
77+
matrix:
78+
asset: ["webhook", "runner-binaries-syncer", "runners"]
79+
permissions:
80+
contents: write
81+
actions: read
9282

9383
steps:
94-
- name: Generate provenance for release
95-
uses: philips-labs/[email protected]
84+
- uses: actions/download-artifact@v3
9685
with:
97-
artifact_path: release-assets
98-
output_path: 'build.provenance'
99-
tag_name: "${{ github.ref_name }}"
100-
env:
101-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
86+
name: ${{ matrix.asset }}
87+
path: artifacts
10288

89+
- name: Upload Release Asset
90+
id: upload-release-asset
91+
uses: actions/upload-release-asset@v1
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
with:
95+
upload_url: ${{ needs.release.outputs.upload_url }}
96+
asset_path: artifacts/${{ matrix.asset }}.zip
97+
asset_name: ${{ matrix.asset }}.zip
98+
asset_content_type: application/zip

0 commit comments

Comments
 (0)