forked from robinbryce/apikeystore
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 2.01 KB
/
cd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build and push to the polysensus container registry
on: [push]
permissions:
id-token: write
contents: read
jobs:
cd:
name: Build and push to the polysensus container registry
runs-on: ubuntu-latest
steps:
- uses: 'actions/checkout@v3'
- uses: 'arduino/setup-task@v1'
with:
version: 3.x
- uses: 'hiberbee/[email protected]'
with:
skaffold-version: 1.37.0
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
token_format: 'access_token'
workload_identity_provider: 'projects/723759996909/locations/global/workloadIdentityPools/github-oidc-1/providers/github-provider'
service_account: '[email protected]'
- uses: 'docker/login-action@v1'
with:
registry: 'eu.gcr.io/hoy-1' # or REGION-docker.pkg.dev
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- run: |-
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://eu.gcr.io/hoy-dev-1
- id: build_id
name: Generate build ID
run: |
branch=${GITHUB_REF##*/}
sha=${GITHUB_SHA::8}
calver=$(date +%g.%m%d).${{ github.run_number }}
buildno=${{ github.run_number }}
echo "branch: $branch, sha: $sha, buildno: $buildno"
# echo "::set-output name=BUILD_ID::${branch}-${sha}-${calver}"
echo "::set-output name=BUILD_ID::${branch}-${buildno}"
- name: Build and publish container image with tag
run: |
export SKAFFOLD_DEFAULT_REPO=eu.gcr.io/hoy-dev-1
task cd-build TAG=${{ steps.build_id.outputs.BUILD_ID }}
#uses: docker/build-push-action@v2
#with:
# push: true
# context: .
# tags: eu.gcr.io/hoy-1/auth-apikeystore:${{ steps.build_id.outputs.BUILD_ID }}