Skip to content

Commit

Permalink
Trigger a pipeline when a new tag is created
Browse files Browse the repository at this point in the history
  • Loading branch information
gmolveau-anssi committed Oct 24, 2024
1 parent be5e45b commit fecff0a
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- master
tags:
- '*'

jobs:
backend-checks:
Expand Down Expand Up @@ -58,6 +60,7 @@ jobs:
build_and_push:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [backend-checks, frontend-checks]

steps:
- uses: actions/checkout@v4
Expand All @@ -68,18 +71,28 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker build the backend docker image
run: |
docker build --target prod --build-arg EURYDICE_VERSION=${GITHUB_REF#refs/tags/} --file ./backend/docker/Dockerfile --tag anssi/eurydice-backend:${GITHUB_REF#refs/tags/} backend
- name: Extract tag name
id: extract_tag
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Docker build the frontend docker image
run: |
docker build --target prod --build-arg EURYDICE_VERSION=${GITHUB_REF#refs/tags/} --file ./frontend/docker/Dockerfile --tag anssi/eurydice-frontend:${GITHUB_REF#refs/tags/} frontend
- name: Docker push backend docker image
run: |
docker push anssi/eurydice-backend:${GITHUB_REF#refs/tags/}
- name: Docker push frontend docker image
run: |
docker push anssi/eurydice-frontend:${GITHUB_REF#refs/tags/}
- name: Build and push frontend Docker image
uses: docker/build-push-action@v2
with:
context: frontend
file: ./frontend/docker/Dockerfile
push: true
tags: anssi/eurydice-frontend:${{ env.TAG_NAME }}
target: prod
build-args: |
EURYDICE_VERSION=${{ env.TAG_NAME }}
- name: Build and push backend Docker image
uses: docker/build-push-action@v2
with:
context: backend
file: ./backend/docker/Dockerfile
push: true
tags: anssi/eurydice-backend:${{ env.TAG_NAME }}
target: prod
build-args: |
EURYDICE_VERSION=${{ env.TAG_NAME }}

0 comments on commit fecff0a

Please sign in to comment.