ci: use releaser app instead of PAT #2069
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: [master] | |
release: | |
types: [created] | |
pull_request: | |
branches: [master] | |
permissions: read-all | |
jobs: | |
build: | |
uses: chgl/.github/.github/workflows/standard-build.yaml@bc38fcaae865b5c200914fdf58239ba902a13842 # v1.8.5 | |
permissions: | |
contents: write | |
id-token: write | |
packages: write | |
pull-requests: write | |
actions: read | |
security-events: write | |
with: | |
enable-build-test-layer: false | |
enable-upload-test-image: false | |
secrets: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
lint: | |
uses: chgl/.github/.github/workflows/standard-lint.yaml@bc38fcaae865b5c200914fdf58239ba902a13842 # v1.8.5 | |
permissions: | |
contents: read | |
pull-requests: write | |
issues: write | |
security-events: write | |
actions: read | |
with: | |
enable-codeql: false | |
enable-validate-gradle-wrapper: false | |
enable-verify-base-image-signature: false | |
secrets: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
create-release-token: | |
runs-on: ubuntu-24-04 | |
if: ${{ github.event_name != 'pull_request' }} | |
outputs: | |
token: ${{ steps.app-token.outputs.token }} | |
steps: | |
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 | |
id: app-token | |
with: | |
app-id: ${{ secrets.RELEASER_APP_ID }} | |
private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
repositories: | | |
kube-powertools | |
release: | |
uses: chgl/.github/.github/workflows/standard-release.yaml@bc38fcaae865b5c200914fdf58239ba902a13842 # v1.8.5 | |
needs: | |
- build | |
- create-release-token | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
secrets: | |
semantic-release-token: ${{ needs.create-release-token.outputs.token }} | |
copy-image-to-dockerhub: | |
name: copy ghcr.io image to DockerHub | |
if: ${{ github.event_name != 'pull_request' }} | |
runs-on: ubuntu-24.04 | |
needs: | |
- build | |
steps: | |
- uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4 | |
- name: Login to DockerHub | |
env: | |
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" | |
run: | | |
echo "${DOCKERHUB_TOKEN}" | crane auth login docker.io --username chgl --password-stdin | |
- name: Copy all tags | |
env: | |
TAGS: ${{ needs.build.outputs.image-tags }} | |
run: | | |
echo "${TAGS}" | while read -r tag; do crane copy "$tag" "${tag/ghcr.io/docker.io}"; done |