use github ref name in the image name creation #14
Workflow file for this run
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: Alpha Deploy | |
on: | |
push: | |
tags: | |
- v*-alpha | |
env: | |
PROJECT_ID: ${{ secrets.GCE_PROJECT }} | |
jobs: | |
setup-build-publish-deploy: | |
name: Setup, Build, Publish, and Deploy | |
runs-on: ubuntu-latest | |
environment: | |
name: alpha | |
url: http://35.236.211.115:4000/ ##use the one generated on deployment | |
env: | |
GCE_INSTANCE: ${{ secrets.GCE_INSTANCE }} | |
GCE_INSTANCE_ZONE: us-east4-c | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# Setup gcloud CLI | |
- run: | | |
sudo apt-get install python2.7 | |
export CLOUDSDK_PYTHON="/usr/bin/python2" | |
- uses: google-github-actions/setup-gcloud@v0 | |
with: | |
version: '290.0.1' | |
service_account_key: ${{ secrets.GCE_SA_KEY }} | |
project_id: ${{ secrets.GCE_PROJECT }} | |
# Configure Docker to use the gcloud command-line tool as a credential | |
# helper for authentication | |
- run: |- | |
gcloud --quiet auth configure-docker | |
# Build the Docker image | |
- name: Build | |
run: | | |
echo '${{ secrets.RELEASES_SECRETS }}' >> config/releases.exs | |
docker build --tag "gcr.io/duncan-openc2-plugfest/twinklyhaha:${GITHUB_REF_NAME}" . | |
# Push the Docker image to Google Container Registry | |
- name: Publish | |
run: |- | |
docker push "gcr.io/duncan-openc2-plugfest/twinklyhaha:${GITHUB_REF_NAME}" | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v0 | |
with: | |
service: twinklyhaha-alpha | |
region: us-east4 | |
image: "gcr.io/duncan-openc2-plugfest/twinklyhaha:${{ github.ref_name }}" |