-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷 Pre build steps and new pull requests CI
- Loading branch information
Showing
3 changed files
with
66 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: 'Test' | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
terraform: | ||
name: 'Test' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Authenticate to GCP | ||
id: auth | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
token_format: access_token | ||
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
- name: Install dependencies | ||
id: deps | ||
run: npm ci | ||
- name: Build | ||
id: build | ||
run: npm run build | ||
- name: List building output | ||
id: list-output | ||
run: ls -l out | ||
- name: Clear bucket | ||
id: clear | ||
run: gcloud storage rm -c gs://${{ secrets.GCP_STORAGE_BUCKET_NAME }}/** || true | ||
- name: Deploy | ||
id: deploy | ||
run: gcloud storage cp -c -r out/* gs://${{ secrets.GCP_STORAGE_BUCKET_NAME }} | ||
- name: Update permissions | ||
id: permissions | ||
run: gcloud storage objects update -r gs://${{ secrets.GCP_STORAGE_BUCKET_NAME }}/* --add-acl-grant=entity=AllUsers,role=READER | ||
- name: Update Pull Request | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const output = `#### Steps | ||
| Step | Status | | ||
| --------------------- | ------------------------------------------------------------ | | ||
| 📦 Build and export | ${{ steps.build.outcome == 'success' && '✔' || '❌' }} | | ||
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: output | ||
}) |
This file contains 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