ci: overhaul workflows

This commit is contained in:
Matthew Penner 2022-12-04 17:24:33 -07:00
parent 9a718b699f
commit 5641e45059
No known key found for this signature in database
2 changed files with 20 additions and 17 deletions

View File

@ -4,8 +4,9 @@ on:
push:
branches:
- develop
tags:
- "v*"
release:
types:
- published
jobs:
build-and-push:
@ -13,18 +14,21 @@ jobs:
runs-on: ubuntu-20.04
# Always run against a tag, even if the commit into the tag has [docker skip] within the commit message.
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
steps:
- name: Code Checkout
- name: Code checkout
uses: actions/checkout@v3
- name: Docker Meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
images: ghcr.io/pterodactyl/wings
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease == false }}
type=ref,event=tag
type=ref,event=branch
- name: Set up QEMU
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Install buildx
@ -43,9 +47,9 @@ jobs:
echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\/v/}"
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Build and push (latest)
uses: docker/build-push-action@v2
if: "!contains(github.ref, 'develop')"
- name: Build and Push (tag)
uses: docker/build-push-action@v3
if: "github.event_name == 'release' && github.event.action == 'published'"
with:
context: .
file: ./Dockerfile
@ -56,9 +60,9 @@ jobs:
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.docker_meta.outputs.tags }}
- name: Build and push (develop)
uses: docker/build-push-action@v2
if: "contains(github.ref, 'develop')"
- name: Build and Push (develop)
uses: docker/build-push-action@v3
if: "github.event_name == 'push' && contains(github.ref, 'develop')"
with:
context: .
file: ./Dockerfile

View File

@ -34,7 +34,6 @@ jobs:
REF: ${{ github.ref }}
run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
echo "version_name=`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`" > $GITHUB_OUTPUT
- name: Create checksum and add to changelog
run: |
@ -59,15 +58,15 @@ jobs:
- name: Create release
id: create_release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref }}
tag_name: ${{ github.ref }}
release_name: ${{ steps.extract_changelog.outputs.version_name }}
body_path: ./RELEASE_CHANGELOG
draft: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
body_path: ./RELEASE_CHANGELOG
- name: Upload amd64 binary
uses: actions/upload-release-asset@v1