Merge pull request #401 from frontendnetwork/dependabot/npm_and_yarn/… #58
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
# Default GitHub build&push workflow | |
# Docs: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages | |
name: Create and publish a Docker image | |
on: | |
push: | |
branches: | |
- main | |
- release | |
- staging | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-prod: | |
if: github.ref != 'refs/heads/staging' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
environment: | |
name: Production | |
url: https://vegancheck.me | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@553b6f090f15b58451081ce157ff1929a266131d | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@0f8c876bafbf5dbce05c36682ec68e9a0274a48a | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-and-push-staging: | |
if: github.ref == 'refs/heads/staging' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
environment: | |
name: Staging | |
url: https://staging.vegancheck.me | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@553b6f090f15b58451081ce157ff1929a266131d | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@0f8c876bafbf5dbce05c36682ec68e9a0274a48a | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |