Skip to content

Fix release CI

Fix release CI #2

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- TARGET: amd64
PLATFORM: linux/amd64
- TARGET: arm64
PLATFORM: linux/arm64/v8
- TARGET: armv7
PLATFORM: linux/arm/v7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
id: build
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
file: Containerfile
platforms: ${{ matrix.PLATFORM }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Copy artifacts
run: |
mkdir -p artifacts
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
TAG=$GITHUB_REF_NAME
else
TAG=$GITHUB_SHA
fi
docker run --rm --entrypoint=cat ghcr.io/${{ github.repository }} /usr/local/bin/mollysocket > artifacts/mollysocket-${{ matrix.TARGET }}-$TAG
- name: Push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: Containerfile
platforms: ${{ matrix.PLATFORM }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Archive artifact
uses: actions/upload-artifact@v2
with:
name: artifacts
path: |
./artifacts
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Create release draft
run: gh release create -d -t "$GITHUB_REF_NAME" "$GITHUB_REF_NAME" ./artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_PAT || secrets.GITHUB_TOKEN }}