-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rebuild all Git Tags on a cron and Basic K8s service deployment (#1)
- Loading branch information
1 parent
0afce66
commit a073785
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: cron | ||
|
||
on: | ||
schedule: | ||
# * is a special character in YAML so you have to quote this string | ||
- cron: '0 * * * *' | ||
|
||
jobs: | ||
|
||
provide-tags: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# checkout repo with all tags | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# set matrix output to all git tags listed in a JSON-parsable array | ||
- id: set-matrix | ||
run: echo "::set-output name=matrix::$( jq -cRs 'split("\n")[:-1]' <<< $(git tag -l) )" | ||
|
||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
|
||
rebuild-tags: | ||
|
||
needs: provide-tags | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DOCKER_HUB_ACCOUNT: bmngld | ||
|
||
strategy: | ||
matrix: | ||
tag: ${{fromJson(needs.provide-tags.outputs.matrix)}} | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.tag }} | ||
|
||
- run: make ci | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
- run: docker tag test $DOCKER_HUB_ACCOUNT/${{ github.event.repository.name }}:${{ matrix.tag }} | ||
|
||
- run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login --username $DOCKER_HUB_ACCOUNT --password-stdin | ||
|
||
- run: docker push $DOCKER_HUB_ACCOUNT/${{ github.event.repository.name }}:${{ matrix.tag }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: container-image-template | ||
spec: | ||
type: LoadBalancer | ||
selector: | ||
app: container-image-template | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 80 | ||
targetPort: 3000 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: container-image-template | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: container-image-template | ||
template: | ||
metadata: | ||
labels: | ||
app: container-image-template | ||
spec: | ||
containers: | ||
- name: node | ||
image: docker.io/bmngld/container-image-template:v0.0.1 | ||
ports: | ||
- containerPort: 3000 | ||
protocol: TCP |