|
6 | 6 | - '*' |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - tagged-release: |
10 | | - name: "Tagged Release" |
11 | | - runs-on: "ubuntu-latest" |
12 | | - |
13 | | - steps: |
14 | | - - uses: "marvinpinto/action-automatic-releases@latest" |
15 | | - id: create_release |
16 | | - with: |
17 | | - repo_token: "${{ secrets.GITHUB_TOKEN }}" |
18 | | - prerelease: false |
19 | | - draft: true |
20 | | - |
21 | | - - name: Output Release URL File |
22 | | - run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt |
23 | | - |
24 | | - - name: Save Release URL file for publish |
25 | | - uses: actions/upload-artifact@v4 |
26 | | - with: |
27 | | - name: release_url |
28 | | - path: release_url.txt |
29 | | - |
30 | | - - uses: little-core-labs/[email protected] |
31 | | - id: tagName |
32 | | - |
33 | | - - name: Output git tag |
34 | | - run: echo "${{ steps.tagName.outputs.tag }}" > git_tag.txt |
35 | | - |
36 | | - - name: Save git tag file for publish |
37 | | - uses: actions/upload-artifact@v4 |
38 | | - with: |
39 | | - name: git_tag |
40 | | - path: git_tag.txt |
41 | | - |
42 | | - build_and_upload: |
43 | | - needs: tagged-release |
44 | | - name: build_and_upload |
| 9 | + release: |
45 | 10 | runs-on: ubuntu-latest |
| 11 | + if: startsWith(github.ref, 'refs/tags/') |
46 | 12 | steps: |
47 | 13 | - uses: actions/checkout@v4 |
48 | | - - name: maven-settings-xml-action |
49 | | - uses: whelk-io/maven-settings-xml-action@v22 |
50 | | - with: |
51 | | - repositories: > |
52 | | - [ |
53 | | - { |
54 | | - "id": "central", |
55 | | - "url": "https://repo1.maven.org/maven2" |
56 | | - }, |
57 | | - { |
58 | | - "id": "github", |
59 | | - "url": "https://maven.pkg.github.com/bitwarden/sdk", |
60 | | - "releases": { |
61 | | - "enabled": "true" |
62 | | - }, |
63 | | - "snapshots": { |
64 | | - "enabled": "true" |
65 | | - } |
66 | | - } |
67 | | - ] |
68 | | - servers: > |
69 | | - [ |
70 | | - { |
71 | | - "id": "github", |
72 | | - "username": "${env.PACKAGES_USER}", |
73 | | - "password": "${env.PACKAGES_ACCESS_TOKEN}", |
74 | | - "configuration": { |
75 | | - "httpConfiguration": { |
76 | | - "all": { |
77 | | - "usePreemptive": "true" |
78 | | - } |
79 | | - } |
80 | | - } |
81 | | - } |
82 | | - ] |
83 | | - profiles: > |
84 | | - [ |
85 | | - { |
86 | | - "id": "github" |
87 | | - } |
88 | | - ] |
89 | | - active_profiles: > |
90 | | - [ |
91 | | - "github" |
92 | | - ] |
93 | | - output_file: .m2/settings.xml |
| 14 | + |
94 | 15 | - uses: actions/setup-java@v4 |
95 | 16 | with: |
96 | 17 | distribution: 'temurin' |
97 | 18 | java-version: '20' |
98 | | - cache: 'maven' |
99 | | - overwrite-settings: 'false' |
100 | | - - name: Set up GPG |
101 | | - run: | |
102 | | - echo "$GPG_PRIVATE_KEY" | gpg --batch --import |
103 | | - env: |
104 | | - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
105 | | - - name: Build with Maven |
106 | | - run: mvn -B -Psign -Dgpg.passphrase=${GPG_PASSPHRASE} -Dtest=org.purejava.integrations.keychain.BitwardenAccessTest install --settings ${{ github.workspace }}/.m2/settings.xml --file pom.xml |
107 | | - env: |
108 | | - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
109 | | - PACKAGES_USER: ${{ secrets.PACKAGES_USER }} |
110 | | - PACKAGES_ACCESS_TOKEN: ${{ secrets.PACKAGES_ACCESS_TOKEN }} |
111 | 19 |
|
112 | | - - name: Load Release URL File from release job |
113 | | - uses: actions/download-artifact@v4 |
114 | | - with: |
115 | | - name: release_url |
116 | | - - name: Get Release File Name & Upload URL |
117 | | - id: get_release_info |
118 | | - run: | |
119 | | - value=`cat release_url.txt` |
120 | | - echo ::set-output name=upload_url::$value |
121 | | - - name: Load git tag from release job |
122 | | - uses: actions/download-artifact@v4 |
123 | | - with: |
124 | | - name: git_tag |
125 | | - - name: Get git tag info |
126 | | - id: get_tag_info |
127 | | - run: | |
128 | | - value=`cat git_tag.txt` |
129 | | - echo ::set-output name=git_tag::$value |
| 20 | + - name: Setup Gradle |
| 21 | + uses: gradle/actions/setup-gradle@v4 |
130 | 22 |
|
131 | | - - name: Sign uber jar with key 5BFB2076ABC48776 |
132 | | - run: | |
133 | | - echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 5BFB2076ABC48776 --detach-sign ./target/cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.jar |
134 | | - env: |
135 | | - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
136 | | - - name: Sign source tarball with key 5BFB2076ABC48776 |
137 | | - if: startsWith(github.ref, 'refs/tags/') |
| 23 | + - name: Import GPG key |
138 | 24 | run: | |
139 | | - git archive --prefix="cryptomator-bitwarden-${{ github.ref_name }}/" -o "cryptomator-bitwarden-${{ github.ref_name }}.tar.gz" ${{ github.ref }} |
140 | | - echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 5BFB2076ABC48776 --detach-sign cryptomator-bitwarden-*.tar.gz |
| 25 | + echo "$GPG_SIGNING_KEY_PW" | gpg --batch --import --yes --passphrase-fd 0 <(echo -n "$GPG_SIGNING_KEY_B64" | base64 --decode) |
141 | 26 | env: |
142 | | - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 27 | + GPG_SIGNING_KEY_B64: ${{ secrets.GPG_PRIVATE_KEY_B64 }} |
| 28 | + GPG_SIGNING_KEY_PW: ${{ secrets.GPG_PASSPHRASE }} |
143 | 29 |
|
144 | | - - name: Upload uber jar |
145 | | - id: upload-release-asset |
146 | | - |
| 30 | + - name: Setup GPG key information |
| 31 | + run: | |
| 32 | + mkdir -p ~/.gradle ~/.gnupg |
| 33 | + echo "signing.gnupg.homeDir=/home/runner/.gnupg" >> ~/.gradle/gradle.properties |
| 34 | + echo "signing.gnupg.executable=gpg" >> ~/.gradle/gradle.properties |
| 35 | + echo "signing.gnupg.keyName=ABC48776" >> ~/.gradle/gradle.properties |
| 36 | + echo "signing.gnupg.passphrase=${GPG_SIGNING_KEY_PW}" >> ~/.gradle/gradle.properties |
147 | 37 | env: |
148 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
149 | | - with: |
150 | | - upload_url: ${{ steps.get_release_info.outputs.upload_url }} |
151 | | - asset_path: ./target/cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.jar |
152 | | - asset_name: cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.jar |
153 | | - asset_content_type: application/java-archive |
| 38 | + GPG_SIGNING_KEY_PW: ${{ secrets.GPG_PASSPHRASE }} |
154 | 39 |
|
155 | | - - name: Upload signature file for uber jar |
156 | | - id: upload-signature-file-for-uber-jar |
157 | | - |
| 40 | + - name: Build package |
| 41 | + run: ./gradlew clean build |
158 | 42 | env: |
159 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
160 | | - with: |
161 | | - upload_url: ${{ steps.get_release_info.outputs.upload_url }} |
162 | | - asset_path: ./target/cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.jar.sig |
163 | | - asset_name: cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.jar.sig |
164 | | - asset_content_type: application/pgp-signature |
| 43 | + GPG_SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
| 44 | + GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
165 | 45 |
|
166 | | - - name: Upload tarball |
167 | | - id: upload-release-asset-2 |
168 | | - |
| 46 | + - name: Release package |
| 47 | + run: ./gradlew githubRelease |
169 | 48 | env: |
170 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
171 | | - with: |
172 | | - upload_url: ${{ steps.get_release_info.outputs.upload_url }} |
173 | | - asset_path: ./cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.tar.gz |
174 | | - asset_name: cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.tar.gz |
175 | | - asset_content_type: application/tar+gzip |
176 | | - |
177 | | - - name: Upload signature file for source tarball |
178 | | - id: upload-signature-file-for-source-tarball |
179 | | - |
180 | | - env: |
181 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
182 | | - with: |
183 | | - upload_url: ${{ steps.get_release_info.outputs.upload_url }} |
184 | | - asset_path: ./cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.tar.gz.sig |
185 | | - asset_name: cryptomator-bitwarden-${{ steps.get_tag_info.outputs.git_tag }}.tar.gz.sig |
186 | | - asset_content_type: application/pgp-signature |
| 49 | + RELEASE_GRADLE_PLUGIN_TOKEN: ${{ secrets.RELEASE_GRADLE_PLUGIN_TOKEN }} |
0 commit comments