-
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (77 loc) · 2.95 KB
/
paper.yml
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
name: 'Check updates and build: Paper Bukkit'
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
permissions:
contents: write
packages: write
env:
PROJECT_NAME: paper
jobs:
check:
name: Check updates
runs-on: ubuntu-latest
outputs:
NEEDS_UPDATE: ${{ steps.fetch.outputs.NEEDS_UPDATE }}
VERSION_NAME: ${{ steps.fetch.outputs.VERSION_NAME }}
BUILD_ID: ${{ steps.fetch.outputs.BUILD_ID }}
DOWNLOAD_NAME: ${{ steps.fetch.outputs.DOWNLOAD_NAME }}
IS_EXPERIMENTAL_BUILD: ${{ steps.fetch.outputs.IS_EXPERIMENTAL_BUILD }}
steps:
- uses: actions/checkout@v4
name: Checkout files
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-go@v4
name: Setup Golang Environment
with:
go-version: '^1.21'
- id: fetch
name: Run fetch script
run: go run fetch.go
- uses: actions-js/push@master
name: Commit & Push changes
if: steps.fetch.outputs.NEEDS_UPDATE == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: "ci: ${{ steps.fetch.outputs.IS_EXPERIMENTAL_BUILD == 'true' && '[experimental] ' || '' }}`${{ steps.fetch.outputs.DOWNLOAD_NAME }}`"
build:
name: Build image
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.NEEDS_UPDATE == 'true'
steps:
- uses: actions/checkout@v4
name: Checkout files
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
build-args: |
PROJECT_NAME=${{ env.PROJECT_NAME }}
VERSION_NAME=${{ needs.check.outputs.VERSION_NAME }}
BUILD_ID=${{ needs.check.outputs.BUILD_ID }}
DOWNLOAD_NAME=${{ needs.check.outputs.DOWNLOAD_NAME }}
tags: |
ghcr.io/pmh-only/${{env.PROJECT_NAME}}:${{ needs.check.outputs.IS_EXPERIMENTAL_BUILD == 'false' && 'latest' || 'experimental' }}
ghcr.io/pmh-only/${{ env.PROJECT_NAME }}:${{ needs.check.outputs.VERSION_NAME }}
ghcr.io/pmh-only/${{ env.PROJECT_NAME }}:${{ needs.check.outputs.VERSION_NAME }}-${{ needs.check.outputs.BUILD_ID }}
labels: |
org.opencontainers.image.source=https://github.com/pmh-only/papermc-image
org.opencontainers.image.description=Container image for PaperMC: ${{ env.PROJECT_NAME }} (${{ needs.check.outputs.DOWNLOAD_NAME }})
org.opencontainers.image.licenses=MIT
cache-from: type=gha
cache-to: type=gha,mode=max