-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (74 loc) · 2.31 KB
/
Copy pathpublish_ghcr.yml
File metadata and controls
86 lines (74 loc) · 2.31 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
name: Deploy Images to GHCR
on:
push:
branches:
- v2
workflow_dispatch:
jobs:
push-image:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- uses: neoforged/actions/checkout@main
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
cache-dependency-path: web-interface/package-lock.json
- name: Build Web Interface
working-directory: web-interface
run: |
npm ci
npm run generate
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle Wrapper
id: build
run: ./gradlew :configureGitHubActions :build :shadowJar
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Create Docker Metadata
id: docker_metadata
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
# custom latest tag, the rest are default values
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
- name: Build Docker Image
uses: docker/build-push-action@v7
with:
context: .
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
notify-build-end:
name: Build notifications (end)
needs: [ "push-image" ]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: neoforged/action-webhooks@v1
name: Send Discord end notification
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ needs.push-image.result }}
version: ${{ needs.push-image.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}