chore(deps): update all non-major dependencies #2676
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: CICD tasks | |
on: | |
push: | |
branches: | |
- '*' | |
paths: | |
- 'lib/**' | |
- 'tasks/**' | |
- 'api-services/**' | |
- 'pnpm*.yaml' | |
- 'package*.json' | |
- 'Dockerfile.tasks' | |
- '.dockerignore' | |
- '.github/workflows/**' | |
tags: | |
- 'v*' | |
pull_request: | |
paths: | |
- 'lib/**' | |
- 'tasks/**' | |
- 'api-services/**' | |
- 'pnpm*.yaml' | |
- 'package*.json' | |
- 'Dockerfile.tasks' | |
- '.dockerignore' | |
- '.github/workflows/**' | |
jobs: | |
build: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
IMAGE: ${{ env.IMAGE_NAME }}@${{ steps.docker-build-and-push.outputs.digest }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lowercase github.repository_owner | |
run: | | |
echo "REPOSITORY_OWNER_LC=${REPOSITORY_OWNER,,}" >>${GITHUB_ENV} | |
env: | |
REPOSITORY_OWNER: ${{ github.repository_owner }} | |
- name: Image name | |
run: | | |
echo "IMAGE_NAME=ghcr.io/${{ env.REPOSITORY_OWNER_LC }}/web-app" >>${GITHUB_ENV} | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
tags: | | |
type=edge | |
type=ref,event=pr | |
type=ref,event=branch,prefix=branch- | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-buildx | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- id: commit | |
uses: pr-mpt/actions-commit-hash@v2 | |
with: | |
commit: "${{ github.sha }}" | |
- name: Build | |
uses: docker/build-push-action@v4 | |
id: docker-build-and-push | |
with: | |
context: . | |
file: Dockerfile.tasks | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
build-args: | | |
VERSION=${{ steps.commit.outputs.short }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Check manifest | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} | |
deploy: | |
name: Deploy to Fly | |
runs-on: ubuntu-latest | |
environment: staging | |
needs: build | |
concurrency: | |
group: ${{ github.workflow }}-${{ vars.FLY_APP }} | |
cancel-in-progress: true | |
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
steps: | |
- name: Setup flyctl | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy | |
run: flyctl deploy --config tasks/fly.toml --app $APP --image $IMAGE --remote-only | |
env: | |
APP: ${{ vars.FLY_APP }} | |
IMAGE: ${{ needs.build.outputs.IMAGE }} |