Add retro #102
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: Swift | |
on: | |
push: | |
branches: | |
- main | |
env: | |
GKE_PROJECT: ${{ secrets.GKE_PROJECT }} | |
GKE_EMAIL: ${{ secrets.GKE_EMAIL }} | |
GITHUB_SHA: ${{ github.sha }} | |
IMAGE: blog | |
jobs: | |
build: | |
runs-on: macos-12 | |
steps: | |
- uses: fwal/setup-swift@v1 | |
with: | |
swift-version: "5.7" | |
- uses: actions/checkout@v1 | |
- name: Build | |
run: swift run -c release | |
- name: Copy Dockerfile | |
run: mv Dockerfile Output | |
- name: Upload Output for upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: output | |
path: Output | |
upload: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download math result for job 2 | |
uses: actions/download-artifact@v1 | |
with: | |
name: output | |
path: . | |
- name: Push to GitHub Packages | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.NEW_PAT }} | |
registry: ghcr.io | |
repository: bourvill/blog | |
tag_with_ref: true | |
tag_with_sha: true | |
update: | |
runs-on: ubuntu-latest | |
needs: upload | |
steps: | |
- name: Check out kub private repo | |
uses: actions/checkout@master | |
with: | |
token: ${{ secrets.PAT }} | |
repository: bourvill/kub-scw | |
- name: Replace img name | |
run: | | |
sed -i "s|image:.*|image: ghcr.io/bourvill/blog:sha-$(echo ${GITHUB_SHA} | cut -c1-7)|g" blog/blog-deployment.yaml | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v4 | |
with: | |
author_name: CI | |
author_email: [email protected] | |
message: "Update blog img" | |
add: "." | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |