Skip to content

Support --pull for build/publish commands #88

Support --pull for build/publish commands

Support --pull for build/publish commands #88

Workflow file for this run

name: publish
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
actions: read
checks: write
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read
contents: write
steps:
-
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Get TAG
id: get_tag
run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
-
name: Set Username/Repo and ImagePrefix as ENV vars
run: |
echo "IMAGE_PREFIX"=$(echo "ghcr.io/$GITHUB_REPOSITORY" | awk '{print tolower($1)}' | sed -e "s/:refs//") >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
-
name: Build and Push container images (non-root)
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
target: release
build-args: |
VERSION=${{ env.TAG }}
GIT_COMMIT=${{ github.sha }}
REPO_URL=https://github.com/openfaas/faas-cli
push: true
tags: |
${{ env.IMAGE_PREFIX }}:${{ github.sha }}
${{ env.IMAGE_PREFIX }}:${{ env.TAG }}
${{ env.IMAGE_PREFIX }}:latest
-
name: Build and Push container images (root)
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
target: root
build-args: |
VERSION=${{ env.TAG }}
GIT_COMMIT=${{ github.sha }}
REPO_URL=https://github.com/openfaas/faas-cli
push: true
tags: |
${{ env.IMAGE_PREFIX }}:${{ github.sha }}-root
${{ env.IMAGE_PREFIX }}:${{ env.TAG }}-root
${{ env.IMAGE_PREFIX }}:latest-root
-
name: Build binaries for multiple environments
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.redist
platforms: linux/amd64
build-args: |
VERSION=${{ env.TAG }}
GIT_COMMIT=${{ github.sha }}
load: true
push: false
tags: |
openfaas/faas-cli:${{ env.TAG }}
-
name: Copy binaries to host
run: ./extract_binaries.sh ${{ env.TAG }}
-
name: Create SHA of binaries
run: cd bin && ../ci/hashgen.sh && cd ../
- name: Upload binaries and their SHA to Github Release
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./bin/faas-cli*"]'