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

View File

@ -34,7 +34,6 @@ jobs:
REF: ${{ github.ref }} REF: ${{ github.ref }}
run: | run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG 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 - name: Create checksum and add to changelog
run: | run: |
@ -59,15 +58,15 @@ jobs:
- name: Create release - name: Create release
id: create_release id: create_release
uses: actions/create-release@v1 uses: softprops/action-gh-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
name: ${{ github.ref }}
tag_name: ${{ github.ref }} tag_name: ${{ github.ref }}
release_name: ${{ steps.extract_changelog.outputs.version_name }}
body_path: ./RELEASE_CHANGELOG
draft: true 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 - name: Upload amd64 binary
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1