Change branch #7
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: 'Publish Docker Image' | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- "charts/**/*" | |
concurrency: | |
group: ${{ github.head_ref }}-container | |
cancel-in-progress: false | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-2-core | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: kubernetes | |
- name: Set up Google Cloud Credentials | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
token_format: "access_token" | |
credentials_json: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }} | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.GOOGLE_HOPRASSOCIATION_PROJECT }} | |
install_components: beta | |
- name: Login Google Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-west3-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: Get package version | |
id: version | |
run: | | |
docker_tag=$(grep -A 1 "hoprd_operator" Cargo.lock | grep version | sed 's/.* "//' | sed 's/"//' | tr -d '\n') | |
echo "DOCKER_TAG=${docker_tag}" >> $GITHUB_OUTPUT | |
- name: Build container image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: | | |
europe-west3-docker.pkg.dev/hoprassociation/docker-images/hoprd-operator:${{ steps.version.outputs.DOCKER_TAG }} | |
europe-west3-docker.pkg.dev/hoprassociation/docker-images/hoprd-operator:latest | |
- name: Tag Docker version | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "HOPR CI robot" | |
git tag ${{ steps.version.outputs.DOCKER_TAG }} | |
git push origin ${{ steps.version.outputs.DOCKER_TAG }} |