Merge pull request #91 from Vatsim-Scandinavia/feature/training-roles #5
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: Docker Build | |
on: | |
push: | |
branches: | |
- main | |
- master | |
env: | |
IMAGE_NAME: vatsim-scandinavia/discord-bot | |
TARGET_PLATFORMS: linux/amd64,linux/arm64 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: login to github container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: setup container metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=pr | |
type=sha,event=branch,prefix= | |
type=semver,event=tag,pattern=v{{version}} | |
type=semver,event=tag,pattern=v{{major}} | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: build & push container image | |
uses: docker/build-push-action@v6 | |
with: | |
context: "{{defaultContext}}:." | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ env.TARGET_PLATFORMS }} |