Skip to content

chore: bump deps

chore: bump deps #159

Workflow file for this run

name: backend
on:
push:
branches:
- master
paths:
- backend/**
- .github/workflows/backend.yml
- Dockerfile.backend
pull_request:
branches:
- master
paths:
- backend/**
- .github/workflows/backend.yml
- Dockerfile.backend
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: backend
args: --modules-download-mode=readonly
- name: Test
run: |
cd ${{ github.workspace }}/backend
go test -timeout=60s -race -covermode atomic -coverprofile=covprofile -coverpkg=./...
- name: Submit coverage
run: |
cd ${{ github.workspace }}/backend
go install github.com/mattn/goveralls@latest
$(go env GOPATH)/bin/goveralls -service=github -coverprofile=covprofile
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: [lint]
env:
DOCKER_CLI_EXPERIMENTAL: enabled
strategy:
matrix:
arch: [amd64, arm64]
os: [linux]
include:
- { arch: amd64, goarch: amd64, goarm: "" }
- { arch: arm64, goarch: arm64, goarm: "" }
steps:
- uses: actions/checkout@v4
- name: secrets
run: |
wget --content-disposition https://lafin.me/secret.json.gpg
secret=$(gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.SECRET_PASSPHRASE }} secret.json.gpg)
dockerUser=`echo $secret | jq -r '.common."docker-user"'`
echo "::add-mask::$dockerUser"; echo "DOCKER_USER=$dockerUser" >> $GITHUB_ENV
dockerToken=`echo $secret | jq -r '.common."docker-token"'`
echo "::add-mask::$dockerToken"; echo "DOCKER_TOKEN=$dockerToken" >> $GITHUB_ENV
- name: Build image
run: |
REPOSITORY=ghcr.io/${{ github.repository }}-api
docker build --build-arg VERSION=${{ github.ref }}:${{ github.sha }} --build-arg GOARCH=${{ matrix.goarch }} --build-arg GOARM=${{ matrix.goarm }} -t $REPOSITORY:${{ matrix.arch }} -f Dockerfile.backend .
- name: Publish image
if: github.ref == 'refs/heads/master'
run: |
REPOSITORY=ghcr.io/${{ github.repository }}-api
echo ${{ env.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ env.DOCKER_USER }} --password-stdin
docker push $REPOSITORY:${{ matrix.arch }}
manifest:
runs-on: ubuntu-latest
needs: [lint, build]
env:
DOCKER_CLI_EXPERIMENTAL: enabled
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: secrets
run: |
wget --content-disposition https://lafin.me/secret.json.gpg
secret=$(gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.SECRET_PASSPHRASE }} secret.json.gpg)
dockerUser=`echo $secret | jq -r '.common."docker-user"'`
echo "::add-mask::$dockerUser"; echo "DOCKER_USER=$dockerUser" >> $GITHUB_ENV
dockerToken=`echo $secret | jq -r '.common."docker-token"'`
echo "::add-mask::$dockerToken"; echo "DOCKER_TOKEN=$dockerToken" >> $GITHUB_ENV
- name: Publish manifest
run: |
REPOSITORY=ghcr.io/${{ github.repository }}-api
echo ${{ env.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ env.DOCKER_USER }} --password-stdin
docker manifest create $REPOSITORY:latest $REPOSITORY:amd64 $REPOSITORY:arm64
docker manifest annotate $REPOSITORY $REPOSITORY:amd64 --arch "amd64" --os "linux" --variant ""
docker manifest annotate $REPOSITORY $REPOSITORY:arm64 --arch "arm64" --os "linux" --variant ""
docker manifest push $REPOSITORY
deploy:
runs-on: ubuntu-latest
needs: [lint, build]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: secrets
run: |
wget --content-disposition https://lafin.me/secret.json.gpg
secret=$(gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.SECRET_PASSPHRASE }} secret.json.gpg)
digitaloceanClusterName=`echo $secret | jq -r '.common."digitalocean-cluster-name"'`
echo "::add-mask::$digitaloceanClusterName"; echo "DIGITALOCEAN_CLUSTER_NAME=$digitaloceanClusterName" >> $GITHUB_ENV
digitaloceanAccessToken=`echo $secret | jq -r '.common."digitalocean-access-token"'`
echo "::add-mask::$digitaloceanAccessToken"; echo "DIGITALOCEAN_ACCESS_TOKEN=$digitaloceanAccessToken" >> $GITHUB_ENV
dockerUser=`echo $secret | jq -r '.common."docker-user"'`
echo "::add-mask::$dockerUser"; echo "DOCKER_USER=$dockerUser" >> $GITHUB_ENV
dockerToken=`echo $secret | jq -r '.common."docker-token"'`
echo "::add-mask::$dockerToken"; echo "DOCKER_TOKEN=$dockerToken" >> $GITHUB_ENV
sshPrivateKey=`echo $secret | jq -r '.common."ssh-private-key"[]'`
while read line; do echo "::add-mask::$line"; done < <(echo "$sshPrivateKey")
echo "SSH_PRIVATE_KEY<<EOF
$sshPrivateKey
EOF" >> $GITHUB_ENV
- name: Setup SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ env.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Deploy
run: |
DIGITALOCEAN_CLUSTER_IP=$(doctl compute droplet get ${{ env.DIGITALOCEAN_CLUSTER_NAME }} --template {{.PublicIPv4}})
ssh-keyscan $DIGITALOCEAN_CLUSTER_IP >> $HOME/.ssh/known_hosts
doctl compute ssh ${{ env.DIGITALOCEAN_CLUSTER_NAME }} --ssh-command " \
echo ${{ env.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ env.DOCKER_USER }} --password-stdin
docker-compose -f infra/docker-compose.${{ env.DIGITALOCEAN_CLUSTER_NAME }}.yml pull test-api; \
docker-compose -f infra/docker-compose.${{ env.DIGITALOCEAN_CLUSTER_NAME }}.yml up -d test-api; \
"