Fix ref #429
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 ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
container: | |
image: appditto/libvips:latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@master | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- name: Run Tests | |
run: | | |
cd server | |
go test ./... | |
build_and_publish_nuxt: | |
name: Build and Publish Nuxt Image | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Login to registry | |
uses: actions-hub/docker/login@master | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and tag | |
if: success() | |
run: docker build -t appditto/natricon-website:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} . | |
- name: Push image | |
if: success() | |
uses: actions-hub/docker@master | |
with: | |
args: push appditto/natricon-website:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
build_and_publish_go: | |
name: Build and Publish GO Image | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Login to registry | |
uses: actions-hub/docker/login@master | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Build and push | |
if: success() | |
uses: docker/build-push-action@v3 | |
with: | |
context: server | |
platforms: linux/amd64 | |
push: true | |
file: ./server/Dockerfile | |
tags: appditto/natricon-server:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
deploy_nuxt: | |
name: Deploy nuxt app | |
needs: build_and_publish_nuxt | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- uses: imranismail/setup-kustomize@v1 | |
with: | |
kustomize-version: "3.5.4" | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Set image | |
working-directory: ./kubernetes/frontend | |
run: | | |
kustomize edit set image replaceme=appditto/natricon-website:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
kustomize build . > nuxt-deployment-k.yaml | |
- name: Deploy image to k8s cluster | |
uses: bbedward/kubectl@master | |
env: | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
with: | |
args: apply -f ./kubernetes/frontend/nuxt-deployment-k.yaml | |
deploy_go: | |
name: Deploy GO app | |
needs: build_and_publish_go | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- uses: imranismail/setup-kustomize@v1 | |
with: | |
kustomize-version: "3.5.4" | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Set image | |
working-directory: ./kubernetes/server | |
run: | | |
kustomize edit set image replaceme=appditto/natricon-server:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
kustomize build . > go-deployment-k.yaml | |
- name: Deploy image to k8s cluster | |
uses: bbedward/kubectl@master | |
env: | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
with: | |
args: apply -f ./kubernetes/server/go-deployment-k.yaml | |