Merge pull request #1 from manifoldfinance/retain-image-version-metadata #2
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
docker-image: | |
name: Publish Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Get tag version | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Get release date | |
run: | | |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: Print version | |
run: | | |
echo $RELEASE_VERSION | |
echo ${{ env.RELEASE_VERSION }} | |
- name: Extract metadata (tags, labels) for Docker images | |
id: meta | |
uses: docker/metadata-action@f7b4ed12385588c3f9bc252f0a2b520d83b52d48 | |
with: | |
images: ghcr.io/${{ github.event.repository.full_name }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{raw}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
build-args: | | |
VERSION=${{ env.RELEASE_VERSION }} | |
VCS_REF=${{ github.event.ref }} | |
BUILD_DATE=${{ env.RELEASE_DATE }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-all: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all tags | |
run: git fetch --force --tags | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.22 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --skip=publish --config .goreleaser-build.yaml --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mev-boost-build | |
path: | | |
dist/mev-boost*.tar.gz | |
dist/mev-boost*.txt | |
release: | |
needs: build-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all tags | |
run: git fetch --force --tags | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.22 | |
- name: Make directories | |
run: | | |
mkdir -p ./build | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: mev-boost-build | |
path: ./build | |
- name: Merge checksum file | |
run: | | |
cd ./build | |
cat ./mev-boost*checksums.txt >> checksums.txt | |
rm ./mev-boost*checksums.txt | |
- name: Release | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
args: release --config .goreleaser-release.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |