app: v1.6.0 #14
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: Build and release faas | |
concurrency: | |
cancel-in-progress: true | |
group: build-faas | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
build: | |
environment: | |
name: production | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Setup faas-cli | |
run: curl -sSL https://cli.openfaas.com | sudo sh | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: radicand | |
password: ${{ secrets.CR_PAT }} | |
- name: Publish functions | |
working-directory: ./server/faas | |
env: | |
REPO_PATH: ghcr.io/${{ github.repository_owner }} | |
OPENFAAS_GATEWAY: ${{ secrets.OPENFAAS_GATEWAY }} | |
run: faas-cli publish -f functions.yaml --platforms linux/arm64 | |
- name: Deploy functions | |
working-directory: ./server/faas | |
env: | |
REPO_PATH: ghcr.io/${{ github.repository_owner }} | |
OPENFAAS_GATEWAY: ${{ secrets.OPENFAAS_GATEWAY }} | |
run: | | |
faas-cli login -p ${{ secrets.OPENFAAS_GATEWAY_PASSWD }} -g ${{ secrets.OPENFAAS_GATEWAY }} && \ | |
faas-cli deploy -f functions.yaml -g ${{ secrets.OPENFAAS_GATEWAY }} | |
- name: Delete packages older than 7 days (but keep at least 3 versions) | |
uses: davahome/[email protected] | |
with: | |
token: ${{ secrets.CR_PAT }} | |
package: cookbookery-faas-photo | |
owner: user | |
minimum_days: 7 | |
keep_versions: 3 | |
delete_untagged: 1 | |
keep_versions_untagged: 3 |