1+ name : release 
2+ on :
3+   push :
4+     branches :
5+       - master 
6+   workflow_dispatch : {} 
7+ jobs :
8+   release :
9+     runs-on : ubuntu-latest 
10+     permissions :
11+       contents : write 
12+     outputs :
13+       latest_commit : ${{ steps.git_remote.outputs.latest_commit }} 
14+     env :
15+       CI : " true" 
16+     steps :
17+       - name : Checkout 
18+         uses : actions/checkout@v3 
19+         with :
20+           fetch-depth : 0 
21+       - name : Set git identity 
22+         run : |- 
23+           git config user.name "github-actions" 
24+           git config user.email "github-actions@github.com" 
25+        - name : Install dependencies 
26+         run : yarn install --check-files --frozen-lockfile 
27+       - name : release 
28+         run : npx projen release 
29+       - name : Check for new commits 
30+         id : git_remote 
31+         run : echo "latest_commit=$(git ls-remote origin -h ${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT 
32+       - name : Backup artifact permissions 
33+         if : ${{ steps.git_remote.outputs.latest_commit == github.sha }} 
34+         run : cd dist && getfacl -R . > permissions-backup.acl 
35+         continue-on-error : true 
36+       - name : Upload artifact 
37+         if : ${{ steps.git_remote.outputs.latest_commit == github.sha }} 
38+         uses : actions/upload-artifact@v3 
39+         with :
40+           name : build-artifact 
41+           path : dist 
42+   release_github :
43+     name : Publish to GitHub Releases 
44+     needs : release 
45+     runs-on : ubuntu-latest 
46+     permissions :
47+       contents : write 
48+     if : needs.release.outputs.latest_commit == github.sha 
49+     steps :
50+       - uses : actions/setup-node@v3 
51+         with :
52+           node-version : 14.x 
53+       - name : Download build artifacts 
54+         uses : actions/download-artifact@v3 
55+         with :
56+           name : build-artifact 
57+           path : dist 
58+       - name : Restore build artifact permissions 
59+         run : cd dist && setfacl --restore=permissions-backup.acl 
60+         continue-on-error : true 
61+       - name : Prepare Repository 
62+         run : mv dist .repo 
63+       - name : Collect GitHub Metadata 
64+         run : mv .repo/dist dist 
65+       - name : Release 
66+         env :
67+           GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} 
68+           GITHUB_REPOSITORY : ${{ github.repository }} 
69+           GITHUB_REF : ${{ github.ref }} 
70+         run : errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi 
71+ 
72+     name : Publish to Maven Central 
73+     needs : release 
74+     runs-on : ubuntu-latest 
75+     permissions :
76+       contents : read 
77+       packages : write 
78+     if : needs.release.outputs.latest_commit == github.sha 
79+     steps :
80+       - uses : actions/setup-java@v3 
81+         with :
82+           distribution : temurin 
83+           java-version : 11.x 
84+       - uses : actions/setup-node@v3 
85+         with :
86+           node-version : 14.x 
87+       - name : Download build artifacts 
88+         uses : actions/download-artifact@v3 
89+         with :
90+           name : build-artifact 
91+           path : dist 
92+       - name : Restore build artifact permissions 
93+         run : cd dist && setfacl --restore=permissions-backup.acl 
94+         continue-on-error : true 
95+       - name : Prepare Repository 
96+         run : mv dist .repo 
97+       - name : Install Dependencies 
98+         run : cd .repo && yarn install --check-files --frozen-lockfile 
99+       - name : Create java artifact 
100+         run : cd .repo && npx projen package:java 
101+       - name : Collect java Artifact 
102+         run : mv .repo/dist dist 
103+       - name : Release 
104+         env :
105+           MAVEN_SERVER_ID : github 
106+           MAVEN_REPOSITORY_URL : https://maven.pkg.github.com/europace/ep-constructs 
107+           MAVEN_PASSWORD : ${{ secrets.GITHUB_TOKEN }} 
108+           MAVEN_USERNAME : ${{ github.actor }} 
109+         run : npx -p publib@latest publib-maven 
0 commit comments