Skip to content

Commit 7d93f15

Browse files
committed
ci: overhaul workflows
1 parent 598c956 commit 7d93f15

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

.github/workflows/docker.yaml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ name: Publish Docker Image
33
on:
44
push:
55
branches:
6-
- "develop"
7-
- "release/v*"
6+
- develop
7+
release:
8+
types:
9+
- published
810

911
jobs:
1012
push:
@@ -17,45 +19,49 @@ jobs:
1719
- name: Code Checkout
1820
uses: actions/checkout@v3
1921

20-
- name: Docker Metadata
21-
uses: docker/metadata-action@v4
22+
- name: Docker metadata
2223
id: docker_meta
24+
uses: docker/metadata-action@v4
2325
with:
2426
images: ghcr.io/pterodactyl/panel
27+
tags: |
28+
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease == false }}
29+
type=ref,event=tag
30+
type=ref,event=branch
2531
2632
- name: Setup QEMU
2733
uses: docker/setup-qemu-action@v2
2834

29-
- name: Setup Docker Buildx
35+
- name: Setup Docker buildx
3036
uses: docker/setup-buildx-action@v2
3137

32-
- name: Docker Login
38+
- name: Login to GitHub Container Registry
3339
uses: docker/login-action@v2
3440
with:
3541
registry: ghcr.io
3642
username: ${{ github.repository_owner }}
3743
password: ${{ secrets.REGISTRY_TOKEN }}
3844

39-
- name: Release production build
40-
uses: docker/build-push-action@v2
41-
if: "contains(github.ref, 'release/v')"
45+
- name: Build and Push (tag)
46+
uses: docker/build-push-action@v3
47+
if: "github.event_name == 'release' && github.event.action == 'published'"
4248
with:
4349
context: .
4450
file: ./Dockerfile
4551
push: true
4652
platforms: linux/amd64,linux/arm64
47-
tags: ${{ steps.docker_meta.outputs.tags }}
4853
labels: ${{ steps.docker_meta.outputs.labels }}
54+
tags: ${{ steps.docker_meta.outputs.tags }}
4955

50-
- name: Release development build
51-
uses: docker/build-push-action@v2
52-
if: "contains(github.ref, 'develop')"
56+
- name: Build and Push (develop)
57+
uses: docker/build-push-action@v3
58+
if: "github.event_name == 'push' && contains(github.ref, 'develop')"
5359
with:
5460
context: .
5561
file: ./Dockerfile
5662
push: ${{ github.event_name != 'pull_request' }}
5763
platforms: linux/amd64,linux/arm64
58-
tags: ${{ steps.docker_meta.outputs.tags }}
5964
labels: ${{ steps.docker_meta.outputs.labels }}
65+
tags: ${{ steps.docker_meta.outputs.tags }}
6066
cache-from: type=gha
6167
cache-to: type=gha,mode=max

.github/workflows/release.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Release
1111
runs-on: ubuntu-20.04
1212
steps:
13-
- name: Code Checkout
13+
- name: Code checkout
1414
uses: actions/checkout@v3
1515

1616
- name: Setup Node
@@ -45,30 +45,26 @@ jobs:
4545
tar -czf panel.tar.gz * .env.example .eslintignore .eslintrc.js
4646
4747
- name: Extract changelog
48-
id: extract_changelog
4948
env:
5049
REF: ${{ github.ref }}
5150
run: |
5251
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
53-
echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`
5452
5553
- name: Create checksum and add to changelog
5654
run: |
5755
SUM=`sha256sum panel.tar.gz`
5856
echo -e "\n#### SHA256 Checksum\n\n\`\`\`\n$SUM\n\`\`\`\n" >> ./RELEASE_CHANGELOG
5957
echo $SUM > checksum.txt
6058
61-
- name: Create Release
59+
- name: Create release
6260
id: create_release
63-
uses: actions/create-release@v1
61+
uses: softprops/action-gh-release@v1
6462
env:
6563
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6664
with:
67-
tag_name: ${{ github.ref }}
68-
release_name: ${{ steps.extract_changelog.outputs.version_name }}
69-
body_path: ./RELEASE_CHANGELOG
7065
draft: true
71-
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
66+
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
67+
body_path: ./RELEASE_CHANGELOG
7268

7369
- name: Upload release archive
7470
id: upload-release-archive

0 commit comments

Comments
 (0)