set service account name #12
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
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 }} |