Skip to content

Merge pull request #127 from SHoogland/feature/timmerdorp-shop #271

Merge pull request #127 from SHoogland/feature/timmerdorp-shop

Merge pull request #127 from SHoogland/feature/timmerdorp-shop #271

Workflow file for this run

---
name: Upload Website
on:
push:
branches:
- main
concurrency: production_environment
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# get the node version from the .nvmrc file
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
# setup node based on the version from the .nvmrc file, fetched in the previous step
- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v4.0.3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
# cache: 'npm'
# run the ci equivalent of npm install
- name: npm ci
run: |
npm ci --only=production
npm run dist
- name: Log in to ghcr.io with docker
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u shoogland --password-stdin
- name: Build docker image
run: |
docker build . --tag "ghcr.io/shoogland/shoogland-com:$GITHUB_SHA" --tag "ghcr.io/shoogland/shoogland-com:latest"
- name: Push to GitHub Packages with latest tag
run: docker push ghcr.io/shoogland/shoogland-com:latest
- name: Push to GitHub Packages with sha tag
run: docker push "ghcr.io/shoogland/shoogland-com:$GITHUB_SHA"
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: get kubectl creds
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 sh-cluster-01
- name: get shoost deployment
run: kubectl get deployment -n argocd www-shoogland -o yaml > deployment.yaml
- name: update image tag
run: sed "s|ghcr.io/shoogland/shoogland-com:.*|ghcr.io/shoogland/shoogland-com:${GITHUB_SHA}|" < deployment.yaml > deployment2.yaml
- name: apply updated image
run: kubectl apply -f deployment2.yaml