Skip to content

Commit 03d3d73

Browse files
authored
🎨 improve gitops template (#45)
* 🎨 add npm token * 📝 update gitops doc for npm token * 🎨 add gradle cache secrets * 📝 add gradle cache doc * 🎨 add docker tag as output * 🎨 add gitopsenabled prop * 🎨 change workflow name * Revert "🎨 add gitopsenabled prop" This reverts commit f00cd74. * Revert ":art: add docker tag as output" This reverts commit 3209e44. * Revert ":memo: add gradle cache doc" This reverts commit 1315562. * Revert ":art: add gradle cache secrets" This reverts commit f9be8dc. * 📝 add discussion link * 🚚 rename docker image name * 🚚 move comment
1 parent f5848c5 commit 03d3d73

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

.github/workflows/template_gitops.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
required: false
1414
type: boolean
1515
default: true
16+
dockerimage:
17+
required: false
18+
type: string
19+
default: private/${{ github.event.repository.name }}
1620
gitopsdev:
1721
required: false
1822
type: string
@@ -22,22 +26,20 @@ on:
2226
gitopsprod:
2327
required: false
2428
type: string
25-
image:
26-
required: false
27-
type: string
28-
default: private/${{ github.event.repository.name }}
2929
secrets:
3030
docker_username:
3131
required: true
3232
docker_password:
3333
required: true
3434
gitops_token:
3535
required: true
36+
npm_token:
37+
required: false
3638

3739
jobs:
3840
gitops:
3941

40-
name: Deploy
42+
name: GitOps
4143
runs-on: ubuntu-20.04
4244

4345
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
@@ -58,9 +60,12 @@ jobs:
5860
dockerusername: ${{ secrets.docker_username }}
5961
dockerpassword: ${{ secrets.docker_password }}
6062
dockerenabled: ${{ inputs.dockerenabled }}
61-
dockerbuildargs: ${{ inputs.dockerbuildargs }}
63+
# remove npm token if feature is available: https://github.com/github-community/community/discussions/17554
64+
dockerbuildargs: |
65+
${{ inputs.dockerbuildargs }}
66+
NPM_TOKEN=${{ secrets.npm_token }}
6267
dockerbuildtarget: ${{ inputs.dockerbuildtarget }}
63-
dockerimage: ${{ inputs.image }}
68+
dockerimage: ${{ inputs.dockerimage }}
6469
gitopstoken: ${{ secrets.gitops_token }}
6570
gitopsdev: ${{ inputs.gitopsdev }}
6671
gitopsstage: ${{ inputs.gitopsstage }}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ jobs:
101101
docker_username: ${{ <your-docker-username> }}
102102
# password for the docker registry
103103
docker_password: ${{ <your-docker-password> }}
104+
# optional: token to pull private npm packages
105+
npm_token: ${{ <your-docker-password> }}
104106
```
105107
</details>
106108
@@ -283,10 +285,6 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
283285
## License 📄
284286

285287
This project is licensed under the Apache-2.0 License - see the [LICENSE.md](LICENSE) file for details.
286-
287-
[1]: https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
288-
[2]: https://github.com/Staffbase/gha-workflows/releases
289-
290288

291289
<table>
292290
<tr>
@@ -300,3 +298,6 @@ This project is licensed under the Apache-2.0 License - see the [LICENSE.md](LIC
300298
</td>
301299
</tr>
302300
</table>
301+
302+
[1]: https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
303+
[2]: https://github.com/Staffbase/gha-workflows/releases

0 commit comments

Comments
 (0)