ci: update STALE-ISSUES workflow from global .github repo (#73) #57
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-verify-package | |
on: | |
push: | |
paths-ignore: | |
#- '.github/**' | |
- '.gitignore' | |
- 'LICENSE' | |
- '*.md' | |
pull_request: | |
paths-ignore: | |
- '.github/**' | |
- '.gitignore' | |
- 'LICENSE' | |
- '*.md' | |
permissions: read-all | |
jobs: | |
build-verify-package: | |
runs-on: ubuntu-latest | |
environment: Build | |
steps: | |
- name: Get current date | |
id: date | |
#run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')" | |
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21.3' | |
- name: Build Go packages | |
run: | | |
./build-binaries.sh github.com/microcks/microcks-cli | |
- name: Set environment for branch | |
run: | | |
set -x | |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then | |
echo "IMAGE_TAG=nightly" >> "$GITHUB_ENV" | |
echo "PACKAGE_IMAGE=true" >> "$GITHUB_ENV" | |
elif [[ $GITHUB_REF == "refs/tags/$GITHUB_REF_NAME" ]]; then | |
echo "IMAGE_TAG=$GITHUB_REF_NAME" >> "$GITHUB_ENV" | |
echo "PACKAGE_IMAGE=true" >> "$GITHUB_ENV" | |
else | |
echo "PACKAGE_IMAGE=false" >> "$GITHUB_ENV" | |
fi | |
- name: Set up QEMU | |
if: github.repository_owner == 'microcks' && env.PACKAGE_IMAGE == 'true' | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
if: github.repository_owner == 'microcks' && env.PACKAGE_IMAGE == 'true' | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Quay.io Registry and setup multi-arch builder | |
if: github.repository_owner == 'microcks' && env.PACKAGE_IMAGE == 'true' | |
run: | | |
echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io | |
BUILDER=buildx-multi-arch | |
docker buildx inspect $BUILDER || docker buildx create --name=$BUILDER --driver=docker-container --driver-opt=network=host | |
- name: Build and push container image for cli | |
if: github.repository_owner == 'microcks' && env.PACKAGE_IMAGE == 'true' | |
run: | | |
docker buildx build --push \ | |
--platform=linux/amd64,linux/arm64 \ | |
--builder=buildx-multi-arch \ | |
--provenance=false \ | |
--build-arg TAG=$IMAGE_TAG \ | |
--file build/Dockerfile \ | |
--label "org.opencontainers.image.revision=${GITHUB_SHA}" \ | |
--label "org.opencontainers.image.created=${{ steps.date.outputs.date }}" \ | |
--tag=quay.io/microcks/microcks-cli:$IMAGE_TAG . |