diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d1288ed..ff4fcc5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,22 +3,39 @@ on: push: branches: - main + tags: + - 'v*' jobs: build: environment: prod runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Docker login + - + uses: actions/checkout@master + - + name: Docker login uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push to Docker Hub + - + name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + images: | + alejoide/bcra-scraper-api + - + name: Build and push to Docker Hub uses: docker/build-push-action@v5 with: context: ./backend tag_with_ref: true tag_with_sha: true - tags: alejoide/bcra-scraper-api:latest + tags: ${{ steps.meta.outputs.tags }} push: true