Push to ACC / Prod on Azure #2
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: Build latest images | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
name: Run Go Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
- name: Run Go Tests | |
run: go test ./... | |
docker: | |
name: Build images | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image: sensorbucket/httpimporter | |
dockerfile: services/httpimporter/Dockerfile | |
context: . | |
- image: sensorbucket/core | |
dockerfile: services/core/Dockerfile | |
context: . | |
- image: sensorbucket/tracing | |
dockerfile: services/tracing/Dockerfile | |
context: . | |
- image: sensorbucket/dashboard | |
dockerfile: services/dashboard/Dockerfile | |
context: . | |
- image: sensorbucket/fission-user-workers | |
dockerfile: services/fission-user-workers/Dockerfile | |
context: . | |
- image: sensorbucket/fission-rmq-connector | |
dockerfile: services/fission-rmq-connector/Dockerfile | |
context: . | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to Azure | |
uses: docker/login-action@v3 | |
with: | |
# Picks staging env or prod env depending on push or tag respectively | |
registry: ${{ secrets.AZURE_REGISTRY }} | |
username: ${{ secrets.AZURE_USER }} | |
password: ${{ secrets.AZURE_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ matrix.image }} | |
${{ secrets.AZURE_REGISTRY }}/${{ matrix.image }} | |
tags: | | |
type=edge | |
type=sha | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{version}} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |