New welcome card #674
Workflow file for this run
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: [pull_request] | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: build-or-deploy | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: jwalton/gh-find-current-pr@v1 | |
id: findPr | |
with: | |
state: all | |
- name: Add tag to env | |
run: echo "TAG=pr-${{ steps.findPr.outputs.pr }}" >> $GITHUB_ENV | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
pull: true | |
push: true | |
tags: camer0/nico:${{ env.TAG }} | |
context: . | |
build-args: | | |
CRYPT64=${{ secrets.CRYPT64 }} | |
COMMIT_SHA=${{ github.event.pull_request.head.sha }} | |
cache-from: type=registry,ref=camer0/nico:buildcache | |
cache-to: type=registry,ref=camer0/nico:buildcache,mode=min | |
file: .docker/image.dockerfile | |
- name: Pull and load image | |
run: docker pull camer0/nico:${{ env.TAG }} | |
- name: Run tests | |
run: | | |
docker run --rm camer0/nico:${{ env.TAG }} bun test | |
- name: Rename tag to :latest in Docker Hub | |
if: contains(github.event.pull_request.labels.*.name, 'deploy') | |
run: | | |
docker buildx imagetools create camer0/nico:${{ env.TAG }} --tag camer0/nico:latest | |
- name: Push to Dokku | |
if: contains( github.event.pull_request.labels.*.name, 'deploy') | |
uses: dokku/github-action@master | |
with: | |
git_remote_url: ${{ secrets.DOKKU_SSH_URL }} | |
ssh_private_key: ${{ secrets.DOKKU_SSH_PK }} | |
git_push_flags: '--force' |