-
-
Notifications
You must be signed in to change notification settings - Fork 185
115 lines (96 loc) · 3.26 KB
/
publish-release.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# GitHub Actions workflow to publish new releases.
name: "Publish releases"
on: workflow_dispatch
env:
JAVA_VERSION: 21
jobs:
github:
name: "GitHub"
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: "${{ steps.version.outputs.version }}"
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Fetch git tags" # Required for axion-release-plugin
run: git fetch --tags --unshallow
- name: "Set up Java ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "liberica"
- name: "Grant execute permission for gradlew"
run: chmod +x gradlew
- name: "Release new version"
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
./gradlew release
- name: "Get current version"
id: version
run: echo "::set-output name=version::$(./gradlew -q -Prelease.quiet cV)"
maven:
name: "Maven"
runs-on: ubuntu-latest
needs: [ github ]
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
ref: "refs/tags/${{ needs.github.outputs.version }}"
- name: "Fetch git tags" # Required for axion-release-plugin
run: git fetch --tags --unshallow
- name: "Set up Java ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "adopt"
- name: "Grant execute permission for gradlew"
run: chmod +x gradlew
- name: "Gradle publish"
uses: gradle/gradle-build-action@v2
with:
arguments: "shadowJar publish"
env:
MAVEN_NAME: ${{ secrets.MAVEN_NAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
docker:
name: "Docker"
runs-on: ubuntu-latest
needs: [ github ]
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
ref: "refs/tags/${{ needs.github.outputs.version }}"
- name: "Fetch git tags" # Required for axion-release-plugin
run: git fetch --tags --unshallow
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v2
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
- name: "Login to DockerHub"
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and push"
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
platforms: "linux/amd64,linux/arm64"
push: true
tags: |
dzikoysk/reposilite:latest
dzikoysk/reposilite:${{ needs.github.outputs.version }}
ghcr.io/dzikoysk/reposilite:latest
ghcr.io/dzikoysk/reposilite:${{ needs.github.outputs.version }}