mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
ci: skip worker build if already built.
This commit is contained in:
parent
1495500f2b
commit
5e065912de
1 changed files with 20 additions and 0 deletions
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
|
@ -62,13 +62,30 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '14'
|
||||||
|
|
||||||
|
- name: Set up Cloud SDK
|
||||||
|
uses: google-github-actions/setup-gcloud@master
|
||||||
|
with:
|
||||||
|
project_id: ${{ secrets.GCS_PROJECT_ID }}
|
||||||
|
service_account_key: ${{ secrets.GCS_TF_KEY }}
|
||||||
|
export_default_credentials: true
|
||||||
|
|
||||||
|
- name: Check if already deployed
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
gsutil stat gs://roleypoly-artifacts/backend-worker/${{ github.sha }}/script.js \
|
||||||
|
&& echo ::set-output name=skip::0 \
|
||||||
|
|| echo ::set-output name=skip::1
|
||||||
|
|
||||||
- run: npm i -g @cloudflare/wrangler
|
- run: npm i -g @cloudflare/wrangler
|
||||||
|
if: steps.check.outputs.skip == '0'
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
|
if: steps.check.outputs.skip == '0'
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
|
if: steps.check.outputs.skip == '0'
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
@ -77,13 +94,16 @@ jobs:
|
||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-yarn-
|
||||||
|
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
|
if: steps.check.outputs.skip == '0'
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
wrangler init
|
wrangler init
|
||||||
echo 'webpack_config = "src/backend-worker/webpack.config.js"' | tee -a wrangler.toml
|
echo 'webpack_config = "src/backend-worker/webpack.config.js"' | tee -a wrangler.toml
|
||||||
wrangler build
|
wrangler build
|
||||||
|
if: steps.check.outputs.skip == '0'
|
||||||
|
|
||||||
- id: upload-file
|
- id: upload-file
|
||||||
|
if: steps.check.outputs.skip == '0'
|
||||||
uses: google-github-actions/upload-cloud-storage@main
|
uses: google-github-actions/upload-cloud-storage@main
|
||||||
with:
|
with:
|
||||||
path: worker/script.js
|
path: worker/script.js
|
||||||
|
|
Loading…
Add table
Reference in a new issue