Skip to content

Commit 0e1be14

Browse files
committed
chore: use OpenShock/actions repository-dispatch and find-latest-tag
1 parent 6c2792f commit 0e1be14

2 files changed

Lines changed: 17 additions & 18 deletions

File tree

‎.github/workflows/ci-build.yml‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,13 @@ jobs:
140140
environment: production
141141
steps:
142142
- name: Send repository dispatch
143-
env:
144-
GH_TOKEN: ${{ secrets.GITOPS_PAT }}
145-
run: |
146-
gh api repos/openshock/kubernetes-cluster-gitops/dispatches \
147-
-f event_type=update-backend-prod \
148-
-F "client_payload[tag]=${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"
143+
uses: OpenShock/actions/repository-dispatch@7e9cf5cd05af3d97a363d80adad50cfe50a273d0 # v1.0.0
144+
with:
145+
repo: openshock/kubernetes-cluster-gitops
146+
event-type: update-backend-prod
147+
client-payload: |
148+
{"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
149+
token: ${{ secrets.GITOPS_PAT }}
149150

150151
deploy-staging:
151152
runs-on: ubuntu-latest
@@ -155,12 +156,13 @@ jobs:
155156

156157
steps:
157158
- name: Send repository dispatch
158-
env:
159-
GH_TOKEN: ${{ secrets.GITOPS_PAT }}
160-
run: |
161-
gh api repos/openshock/kubernetes-cluster-gitops/dispatches \
162-
-f event_type=update-backend-staging \
163-
-F "client_payload[tag]=${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"
159+
uses: OpenShock/actions/repository-dispatch@7e9cf5cd05af3d97a363d80adad50cfe50a273d0 # v1.0.0
160+
with:
161+
repo: openshock/kubernetes-cluster-gitops
162+
event-type: update-backend-staging
163+
client-payload: |
164+
{"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
165+
token: ${{ secrets.GITOPS_PAT }}
164166

165167
deploy-dev:
166168
runs-on: ubuntu-latest

‎.github/workflows/ci-tag.yml‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ jobs:
2121
steps:
2222
- name: Find latest tag
2323
id: latest-tag
24-
env:
25-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
run: |
27-
tag=$(gh api "repos/${{ github.repository }}/tags" --paginate --jq '.[].name' \
28-
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
29-
echo "tag=$tag" >> "$GITHUB_OUTPUT"
24+
uses: OpenShock/actions/find-latest-tag@7e9cf5cd05af3d97a363d80adad50cfe50a273d0 # v1.0.0
25+
with:
26+
regex: '^[0-9]+\.[0-9]+\.[0-9]+$'
3027

3128
# Delegate building and containerizing to a single workflow.
3229
build-and-containerize:

0 commit comments

Comments
 (0)