more ci/cd work, build worker and publish

This commit is contained in:
41666 2020-12-06 17:59:24 -05:00
parent 0b769913fb
commit 95a5732457
5 changed files with 185 additions and 9 deletions

View file

@ -50,12 +50,52 @@ jobs:
- run: yarn test
worker_build:
runs-on: ubuntu-latest
name: Worker Build & Publish
needs:
- node_test
steps:
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: npx wrangler build
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_TF_KEY }}
export_default_credentials: true
- name: Publish to GCS
run: |
gsutil cp worker/script.js gs://roleypoly-artifacts/backend-worker/${{ github.sha }}
docker_build:
name: Docker Build & Publish
runs-on: ubuntu-latest
needs:
- go_test
- node_test
outputs:
ui_digest: ${{steps.docker_push_ui.outputs.digest}}
bot_digest: ${{steps.docker_push_bot.outputs.digest}}
strategy:
matrix:
dockerfile:
@ -77,7 +117,7 @@ jobs:
with:
images: |
ghcr.io/roleypoly/${{matrix.dockerfile}}
us-docker.pkg.dev/roleypoly/roleypoly/${{matrix.dockerfile}}
tag-sha: true
- name: Set up Docker Buildx
id: buildx
@ -92,15 +132,9 @@ jobs:
username: roleypoly
password: ${{ secrets.GHCR_PAT }}
- name: Login to GAR
uses: docker/login-action@v1
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Build and push
uses: docker/build-push-action@v2
id: docker_push_${{ matrix.dockerfile }}
with:
context: .
file: ./hack/dockerfiles/${{matrix.dockerfile}}.Dockerfile