Deploy file server refs/heads/main #27
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: File server build & image publish | |
run-name: Deploy file server ${{ github.ref }} | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "Cargo.toml" | |
- "crates/file-server/**" | |
workflow_dispatch: {} | |
env: | |
PROJECT_ID: "parity-zombienet" | |
GCR_REGISTRY: "europe-west3-docker.pkg.dev" | |
GCR_REPOSITORY: "zombienet-public-images" | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup gcloud CLI | |
uses: google-github-actions/[email protected] | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
project_id: ${{ env.PROJECT_ID }} | |
export_default_credentials: true | |
- name: Login to GCP | |
uses: google-github-actions/[email protected] | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- name: Artifact registry authentication | |
run: | | |
gcloud auth configure-docker ${{ env.GCR_REGISTRY }} | |
- name: Build, tag, and push image to GCP Artifact registry | |
id: build-image | |
env: | |
IMAGE: "${{ env.GCR_REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.GCR_REPOSITORY }}/zombienet-file-server" | |
run: | | |
docker build -t $IMAGE:${{ github.sha }} -f ./crates/file-server/Dockerfile . | |
docker tag $IMAGE:${{ github.sha }} $IMAGE:latest | |
docker push --all-tags $IMAGE | |
echo "image=$IMAGE:${{ github.sha }}" >> $GITHUB_OUTPUT | |
echo "image=$IMAGE:latest" >> $GITHUB_OUTPUT |