Skip to content

Commit 6e25dca

Browse files
committed
Add publishing workflow
1 parent 4f6bfb8 commit 6e25dca

File tree

7 files changed

+98
-1
lines changed

7 files changed

+98
-1
lines changed

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
environment: release
10+
11+
permissions:
12+
packages: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Run Build
18+
run: ./amper build
19+
20+
- name: Run Tests
21+
run: ./amper test
22+
23+
- name: Set Release Info
24+
uses: cuchi/[email protected]
25+
with:
26+
template: publish.module-template.yaml.j2
27+
output_file: publish.module-template.yaml
28+
env:
29+
PUBLISH_REPO: https://maven.pkg.github.com/${{ github.repository }}
30+
PUBLISH_GROUP: net.alphadev
31+
PUBLISH_VERSION: 1.0.${{github.run_number}}
32+
33+
- name: Set up credentials
34+
run: |
35+
echo "github.username=$REPO_OWNER" > local.properties
36+
echo "github.password=$GITHUB_TOKEN" >> local.properties
37+
env:
38+
REPO_OWNER: ${{ github.repository_owner }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Release snapshot
42+
id: release-snapshot
43+
uses: actions/create-release@latest
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
tag_name: 1.0.${{github.run_number}}
48+
release_name: 1.0.${{github.run_number}}
49+
draft: false
50+
prerelease: false
51+
52+
- name: Publish
53+
run: ./amper publish github

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/build
1+
/build
2+
local.properties
3+

app/module.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ product: jvm/app
33
dependencies:
44
- ../lib
55
- "com.github.ajalt.clikt:clikt:5.0.3"
6+
7+
settings:
8+
publishing:
9+
name: opml-tool
10+
11+
apply:
12+
- ../publish.module-template.yaml

lib/module.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ dependencies:
1212
settings:
1313
kotlin:
1414
serialization: enabled
15+
publishing:
16+
name: kotlin-opml
17+
18+
apply:
19+
- ../publish.module-template.yaml

local.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.username=
2+
github.password=

publish.module-template.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repositories:
2+
- id: github
3+
url: https://maven.pkg.github.com/janseeger/kotlin-opml
4+
resolve: false
5+
publish: true
6+
credentials:
7+
file: local.properties
8+
usernameKey: github.username
9+
passwordKey: github.password
10+
11+
settings:
12+
publishing:
13+
group: net.alphadev
14+
version: 0.0.0

publish.module-template.yaml.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repositories:
2+
- id: github
3+
url: {{ env['PUBLISH_REPO'] }}
4+
resolve: false
5+
publish: true
6+
credentials:
7+
file: local.properties
8+
usernameKey: github.username
9+
passwordKey: github.password
10+
11+
settings:
12+
publishing:
13+
group: {{ env['PUBLISH_GROUP'] }}
14+
version: {{ env['PUBLISH_VERSION'] }}

0 commit comments

Comments
 (0)