Build & Deploy Pix Site and Pix pro to Scaleway #1191
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 & Deploy Pix Site and Pix pro to Scaleway | |
on: | |
workflow_dispatch: | |
push: | |
# Pattern matched against refs/tags | |
tags: | |
- '*' # Push events to every tag not containing / ( prevents tags like v1.2.3/beta ) | |
jobs: | |
get-last-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
last_tag: ${{ steps.last-release.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get latest release | |
id: last-release | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
with: | |
semver_only: true | |
build-and-push-image: | |
strategy: | |
matrix: | |
include: | |
- site: pix-site | |
domain-url-fr: ${{ vars.PIX_SITE_DOMAIN_FR }} | |
domain-url-org: ${{ vars.PIX_SITE_DOMAIN_ORG }} | |
matomo-container: ${{ vars.PIX_SITE_MATOMO_CONTAINER }} | |
- site: pix-pro | |
domain-url-fr: ${{ vars.PIX_PRO_DOMAIN_FR }} | |
domain-url-org: ${{ vars.PIX_PRO_DOMAIN_ORG }} | |
matomo-container: ${{ vars.PIX_PRO_MATOMO_CONTAINER }} | |
runs-on: ubuntu-latest | |
needs: get-last-tag | |
env: | |
build_site: ${{ matrix.site }} | |
last_tag: ${{ needs.get-last-tag.outputs.last_tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: nologin | |
password: ${{ secrets.SCW_PRODUCTION_SECRET_KEY }} | |
registry: ${{ secrets.CONTAINER_REGISTRY_PRODUCTION_ENDPOINT }} | |
- name: Build and push ${{ matrix.site }} | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.CONTAINER_REGISTRY_PRODUCTION_ENDPOINT }}/${{ env.build_site }}:latest,${{ secrets.CONTAINER_REGISTRY_PRODUCTION_ENDPOINT }}/${{ env.build_site }}:${{ env.last_tag }} | |
context: . | |
build-args: | | |
SITE=${{ matrix.site }} | |
DOMAIN_FR=${{ matrix.domain-url-fr }} | |
DOMAIN_ORG=${{ matrix.domain-url-org }} | |
MATOMO_CONTAINER=${{ matrix.matomo-container }} | |
EASIWARE_SCRIPT_URL=${{ vars.EASIWARE_SCRIPT_URL }} | |
deploy-containers: | |
needs: [get-last-tag, build-and-push-image] | |
runs-on: ubuntu-latest | |
env: | |
last_tag: ${{ needs.get-last-tag.outputs.last_tag }} | |
custom-args: environment-variables.NGINX_GEOAPI_UPSTREAM_HOST=${{ secrets.NGINX_GEOAPI_UPSTREAM_HOST }} | |
steps: | |
- name: Use CLI | |
uses: scaleway/action-scw@v0 | |
with: | |
save-config: true | |
export-config: true | |
version: v2.30.0 | |
access-key: ${{ secrets.SCW_PRODUCTION_ACCESS_KEY }} | |
secret-key: ${{ secrets.SCW_PRODUCTION_SECRET_KEY }} | |
default-project-id: ${{ secrets.SCW_DEFAULT_PROJECT_ID }} | |
default-organization-id: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }} | |
- uses: scaleway/action-scw@v0 | |
name: update pix-site container tag | |
with: | |
args: container container update "${{ secrets.SCW_PRODUCTION_PIX_SITE_CONTAINER_ID }}" registry-image=${{ secrets.CONTAINER_REGISTRY_PRODUCTION_ENDPOINT }}/pix-site:${{ needs.get-last-tag.outputs.last_tag }} "${{ env.custom-args}}" | |
- uses: scaleway/action-scw@v0 | |
name: update pix-pro container tag | |
with: | |
args: container container update "${{ secrets.SCW_PRODUCTION_PIX_PRO_CONTAINER_ID }}" registry-image=${{ secrets.CONTAINER_REGISTRY_PRODUCTION_ENDPOINT }}/pix-pro:${{ needs.get-last-tag.outputs.last_tag }} "${{ env.custom-args}}" |