Release 1.0.0a3 #7
Workflow file for this run
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: 'PortalBrasil: Intranet - Tag' | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
IMAGE_NAME_PREFIX: ghcr.io/plonegovbr/portalbrasil-intranet | |
jobs: | |
config: | |
runs-on: ubuntu-latest | |
outputs: | |
BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }} | |
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }} | |
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Compute several vars needed for the build | |
id: vars | |
run: | | |
echo 'BASE_TAG=sha-'$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT | |
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT | |
python3 -c 'import json; data = json.load(open("./frontend/mrs.developer.json")); print("VOLTO_VERSION=" + data["core"].get("tag") or "latest")' >> $GITHUB_OUTPUT | |
- name: Test vars | |
run: | | |
echo 'BASE_TAG=${{ steps.vars.outputs.BASE_TAG }}' | |
echo "PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}" | |
echo 'VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}' | |
backend: | |
runs-on: ubuntu-latest | |
needs: | |
- config | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME_PREFIX }}-backend | |
labels: | | |
org.label-schema.docker.cmd=docker run -d -p 8080:8080 ${{ env.IMAGE_NAME_PREFIX }}-backend:latest | |
flavor: | |
latest=false | |
tags: | | |
type=ref,event=branch | |
type=sha | |
type=pep440,pattern={{version}} | |
type=pep440,pattern={{major}}.{{minor}} | |
type=pep440,pattern={{major}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
context: backend | |
file: backend/Dockerfile | |
load: true | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
PLONE_VERSION=${{ needs.config.outputs.PLONE_VERSION }} | |
- name: Docker meta | |
id: meta-demo | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME_PREFIX }}-demo | |
labels: | | |
org.label-schema.docker.cmd=docker run -d -p 8080:8080 ${{ env.IMAGE_NAME_PREFIX }}-demo:latest | |
flavor: | |
latest=false | |
tags: | | |
type=ref,event=branch | |
type=sha | |
type=pep440,pattern={{version}} | |
type=pep440,pattern={{major}}.{{minor}} | |
type=pep440,pattern={{major}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push demo | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
context: backend | |
file: backend/Dockerfile.demo | |
load: true | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta-demo.outputs.tags }} | |
labels: ${{ steps.meta-demo.outputs.labels }} | |
build-args: | | |
SEED=${{ github.run_id }} | |
IMAGE_TAG=${{ needs.config.outputs.BASE_TAG }} | |
frontend: | |
runs-on: ubuntu-latest | |
needs: | |
- config | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME_PREFIX }}-frontend | |
labels: | | |
org.label-schema.docker.cmd=docker run -d -p 3000:3000 ${{ env.IMAGE_NAME_PREFIX }}-frontend:latest | |
flavor: | |
latest=false | |
tags: | | |
type=ref,event=branch | |
type=sha | |
type=pep440,pattern={{version}} | |
type=pep440,pattern={{major}}.{{minor}} | |
type=pep440,pattern={{major}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
context: frontend | |
file: frontend/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
VOLTO_VERSION=${{ needs.config.outputs.VOLTO_VERSION }} |