forked from Sharkord/sharkord
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (95 loc) · 3.28 KB
/
release.yml
File metadata and controls
110 lines (95 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Manual Release
on:
workflow_dispatch:
inputs:
bump:
description: "Version bump"
required: true
type: choice
options:
- none
- patch
- minor
- major
default: "none"
permissions:
contents: write
pull-requests: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.5
- name: Install dependencies
run: bun install
- name: Build app
run: |
cd apps/server
bun run build --bump ${{ inputs.bump }}
- name: Get new version
id: get_version
run: echo "::set-output name=version::$(jq -r .version package.json)"
- name: Identify user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/sharkord:latest
${{ secrets.DOCKER_USERNAME }}/sharkord:v${{ steps.get_version.outputs.version }}
labels: |
org.opencontainers.image.title=Sharkord
org.opencontainers.image.description=Sharkord Server
org.opencontainers.image.version=${{ steps.get_version.outputs.version }}
org.opencontainers.image.source=https://github.com/Sharkord/sharkord
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: v${{ steps.get_version.outputs.version }}
draft: true
files: |
apps/server/build/out/sharkord-linux-x64
apps/server/build/out/sharkord-linux-arm64
apps/server/build/out/sharkord-windows-x64.exe
apps/server/build/out/sharkord-macos-x64
apps/server/build/out/sharkord-macos-arm64
apps/server/build/out/release.json
body: |
## Changes
(TODO)
## Docker Image
```bash
docker pull ${{ secrets.DOCKER_USERNAME }}/sharkord:v${{ steps.get_version.outputs.version }}
```
- name: Commit and push version bump
if: ${{ inputs.bump != 'none' }}
run: |
git add .
git commit -m "chore: bump version to ${{ steps.get_version.outputs.version }}"
git push
- name: Create Git tag
run: |
git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release v${{ steps.get_version.outputs.version }}"
git push origin "v${{ steps.get_version.outputs.version }}"