Skip to content

Upgraded dependencies #69

Upgraded dependencies

Upgraded dependencies #69

Workflow file for this run

name: Build and publish
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOMAIN: gaurav.dev
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
env:
GO111MODULE: on
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Go - This is just for failing fast
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Install enumer and run go:generate
run: |
go install github.com/dmarkham/enumer@latest
go generate ./...
- name: Build the server
run: go build server.go
- name: Install Node - This is just for failing fast
uses: actions/setup-node@v3
env:
NODE_OPTIONS: "--openssl-legacy-provider"
with:
node-version: 20
- name: Build the UI
run: |
npm install --location=global npm
npx browserslist@latest --update-db
npm install
npm run build
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PAT }}
- name: Log in to the GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_PACKAGE_PAT }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Deploy the image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
# Sometimes you gotta bear the burden of working with rootful containers (:
script: |
set +o history
sudo podman stop ${{ secrets.CONTAINER_NAME }} && sudo podman rm ${{ secrets.CONTAINER_NAME }}
sudo podman pull ${{ steps.meta.outputs.tags }}
sudo podman run -d -p ${{ secrets.CONTAINER_EXTERNAL_PORT }}:${{ secrets.CONTAINER_INTERNAL_PORT }} \
-e GIN_MODE="${{ secrets.CONTAINER_GIN_MODE }}" \
-e KEEP_ALIVE_CRON="${{ secrets.CONTAINER_KEEP_ALIVE_CRON }}" \
-e KEEP_ALIVE_BASE_URL="${{ secrets.CONTAINER_KEEP_ALIVE_BASE_URL }}" \
-e APP_AUTH="${{ secrets.CONTAINER_APP_AUTH }}" \
-e MONGO_URI="${{ secrets.CONTAINER_MONGO_URI }}" \
-e MS_CLIENT_ID="${{ secrets.CONTAINER_MS_CLIENT_ID }}" \
-e MS_EMAIL_KEY="${{ secrets.CONTAINER_MS_EMAIL_KEY }}" \
-e MS_GRAPH_SELF_USER_ID="${{ secrets.CONTAINER_MS_GRAPH_SELF_USER_ID }}" \
-e MS_SECRET_ID="${{ secrets.CONTAINER_MS_SECRET_ID }}" \
-e MS_TENANT_ID="${{ secrets.CONTAINER_MS_TENANT_ID }}" \
-e SELF_EMAIL="${{ secrets.CONTAINER_SELF_EMAIL }}" \
-e PORT="${{ secrets.CONTAINER_INTERNAL_PORT }}" \
-e TLS_ENABLED="${{ secrets.CONTAINER_TLS_ENABLED }}" \
-e TLS_CERT_PATH="${{ secrets.CONTAINER_INTERNAL_TLS_CERTS_DIR }}/cert.pem" \
-e TLS_KEY_PATH="${{ secrets.CONTAINER_INTERNAL_TLS_CERTS_DIR }}/key.pem" \
-v ${{ secrets.CONTAINER_EXTERNAL_TLS_CERTS_DIR }}:${{ secrets.CONTAINER_INTERNAL_TLS_CERTS_DIR }}/:Z \
--name "${{ secrets.CONTAINER_NAME }}" \
${{ steps.meta.outputs.tags }}
set -o history