Skip to content

Commit d7b514d

Browse files
update (#141)
1 parent 0ac26bf commit d7b514d

3 files changed

Lines changed: 25 additions & 60 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ on:
88
env:
99
DOCKER_FILE_PATH: Dockerfile
1010
GOLANG_VERSION: 1.17.7
11+
CONTAINER_REGISTRY_URL: ghcr.io/stakater
1112

1213
jobs:
1314
build:
14-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-latest
1516
name: Build
16-
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
17+
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
1718
steps:
1819
- name: Check out code
1920
uses: actions/checkout@v4
@@ -38,7 +39,7 @@ jobs:
3839
sha=${{ github.event.pull_request.head.sha }}
3940
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
4041
echo "##[set-output name=GIT_TAG;]$(echo ${tag})"
41-
42+
4243
- name: Set up QEMU
4344
uses: docker/setup-qemu-action@v3
4445

@@ -47,10 +48,9 @@ jobs:
4748

4849
- name: Generate image repository path
4950
run: |
50-
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
51+
echo IMAGE_REPOSITORY=$(echo ${{ env.CONTAINER_REGISTRY_URL }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
5152
5253
# To identify any broken changes in dockerfiles or dependencies
53-
5454
- name: Build image
5555
uses: docker/build-push-action@v6
5656
with:
@@ -63,32 +63,4 @@ jobs:
6363
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
6464
labels: |
6565
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
66-
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
6766
org.opencontainers.image.revision=${{ github.sha }}
68-
69-
# - name: Comment on PR
70-
# uses: mshick/add-pr-comment@v2
71-
# env:
72-
# GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
73-
# with:
74-
# message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
75-
# allow-repeats: false
76-
77-
# - name: Notify Failure
78-
# if: failure()
79-
# uses: mshick/add-pr-comment@v2
80-
# env:
81-
# GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
82-
# with:
83-
# message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
84-
# allow-repeats: false
85-
86-
# - name: Notify Slack
87-
# uses: 8398a7/action-slack@v3
88-
# if: always() # Pick up events even if the job fails or is canceled.
89-
# with:
90-
# status: ${{ job.status }}
91-
# fields: repo,author,action,eventName,ref,workflow
92-
# env:
93-
# GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
94-
# SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}

.github/workflows/push.yml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ env:
1010
GOLANG_VERSION: 1.17.7
1111
OPERATOR_SDK_VERSION: "1.2.0"
1212
KUSTOMIZE_VERSION: "3.5.4"
13+
CONTAINER_REGISTRY_URL: ghcr.io/stakater
1314

1415
jobs:
1516
build:
1617
name: Build
1718
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
1819
runs-on: ubuntu-latest
19-
20+
2021
steps:
2122
- name: Check out code
2223
uses: actions/checkout@v4
2324
with:
24-
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
2525
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
2626

2727
- name: Set up Go
@@ -39,12 +39,12 @@ jobs:
3939
id: generate_tag
4040
uses: anothrNick/github-tag-action@1.71.0
4141
env:
42-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
42+
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
4343
WITH_V: true
4444
DEFAULT_BUMP: patch
4545
RELEASE_BRANCHES: master
4646
DRY_RUN: true
47-
47+
4848
- name: Set up QEMU
4949
uses: docker/setup-qemu-action@v3
5050

@@ -54,12 +54,13 @@ jobs:
5454
- name: Login to Registry
5555
uses: docker/login-action@v3
5656
with:
57-
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
58-
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}
57+
registry: ${{ env.CONTAINER_REGISTRY_URL }}
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GHCR_TOKEN }}
5960

6061
- name: Generate image repository path
6162
run: |
62-
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
63+
echo IMAGE_REPOSITORY=$(echo ${{ env.CONTAINER_REGISTRY_URL }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
6364
6465
- name: Build and push
6566
uses: docker/build-push-action@v6
@@ -68,21 +69,20 @@ jobs:
6869
file: ${{ env.DOCKER_FILE_PATH }}
6970
pull: true
7071
push: true
71-
build-args: GIT_ACCESS_TOKEN=${{ secrets.STAKATER_GITHUB_TOKEN }}
72+
build-args: GIT_ACCESS_TOKEN=${{ secrets.PUBLISH_TOKEN }}
7273
cache-to: type=inline
7374
tags: |
7475
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
7576
labels: |
7677
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
77-
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
7878
org.opencontainers.image.revision=${{ github.sha }}
7979
8080
# Generate tag for operator without "v"
8181
- name: Generate Operator Tag
8282
id: generate_operator_tag
8383
uses: anothrNick/github-tag-action@1.71.0
8484
env:
85-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
85+
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
8686
WITH_V: false
8787
DEFAULT_BUMP: patch
8888
RELEASE_BRANCHES: master
@@ -93,30 +93,23 @@ jobs:
9393
env:
9494
VERSION: ${{ steps.generate_operator_tag.outputs.new_tag }}
9595
run: make bump-chart
96-
96+
9797
- name: Update Chart CRDs
9898
run: make manifests
99-
99+
100100
# Setting up helm binary
101101
- uses: azure/setup-helm@v4
102102

103-
# # Publish helm chart to nexus
104-
# - name: Publish Helm chart
105-
# run: |
106-
# helm package ./charts/konfigurator --destination ./packaged-chart
107-
# curl -u ${{ secrets.STAKATER_NEXUS_PROD_HELM_USERNAME }}:${{ secrets.STAKATER_NEXUS_PROD_HELM_PASSWORD }} ${{ secrets.STAKATER_NEXUS_PROD_HELM_REGISTRY }} --upload-file ./packaged-chart/*.tgz
108-
# rm -rf ./packaged-chart
109-
110103
# Publish helm chart
111104
- name: Publish Helm chart
112105
uses: stefanprodan/helm-gh-pages@master
113106
with:
114107
branch: master
115108
repository: stakater-charts
116109
target_dir: docs
117-
token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
110+
token: ${{ secrets.PUBLISH_TOKEN }}
118111
charts_dir: charts
119-
charts_url: https://stakater.github.io/stakater-charts
112+
charts_url: ${{ secrets.HELM_REGISTRY_URL }}
120113
owner: stakater
121114
linting: off
122115
commit_username: stakater-user
@@ -127,18 +120,20 @@ jobs:
127120
run: |
128121
git config --local user.email "github-root@stakater.com"
129122
git config --local user.name "stakater-github-root"
130-
git status
123+
git status
131124
git add .
132125
git commit -m "[skip-ci] Update artifacts" -a
126+
133127
- name: Push changes
134128
uses: ad-m/github-push-action@master
135129
with:
136-
github_token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
130+
github_token: ${{ secrets.PUBLISH_TOKEN }}
137131
branch: master
132+
138133
- name: Push Latest Tag
139134
uses: anothrNick/github-tag-action@1.71.0
140135
env:
141-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
136+
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
142137
WITH_V: true
143138
RELEASE_BRANCHES: master
144139
DEFAULT_BUMP: patch
@@ -150,5 +145,4 @@ jobs:
150145
status: ${{ job.status }}
151146
fields: repo,author,action,eventName,ref,workflow
152147
env:
153-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
154148
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
version: latest
3232
args: release --clean
3333
env:
34-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
34+
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
3535

3636
- name: Notify Slack
3737
uses: 8398a7/action-slack@v3
@@ -40,5 +40,4 @@ jobs:
4040
status: ${{ job.status }}
4141
fields: repo,author,action,eventName,ref,workflow
4242
env:
43-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
4443
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)