Build Image on New Release #3176
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 Image on New Release | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Specify the Stride version tag" | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Version | |
run: | | |
version=${{ github.event.inputs.version || github.ref }} | |
version=${version#refs/tags/} | |
echo "version=$version" >> $GITHUB_ENV | |
echo "Version: $version" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.version }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up gcloud Cloud SDK environment | |
uses: google-github-actions/[email protected] | |
with: | |
version: "389.0.0" | |
service_account_key: ${{ secrets.GCP_KEY }} | |
project_id: ${{ secrets.GCP_NODES_PROJECT }} | |
export_default_credentials: true | |
- name: GCloud Configure Docker | |
run: | | |
gcloud auth configure-docker gcr.io | |
- name: Build and Push Image | |
env: | |
DOCKER_BUILDKIT: 1 | |
shell: bash | |
run: | | |
tag=gcr.io/stride-nodes/core/stride:${{ env.version }} | |
docker build -t $tag . | |
docker push $tag |