Next batch #235
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: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test-webapp: | |
defaults: | |
run: | |
working-directory: webapp | |
timeout-minutes: 10 | |
# We're running on ubuntu-latest, nothing special | |
runs-on: ubuntu-latest | |
steps: | |
# As usual, we simply checkout the project | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v2.1.0 | |
with: | |
version: 8.2.0 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Create and populate .env file | |
run: | | |
cat <<EOF > .env | |
MAILERSEND_API_KEY="${{ secrets.MAILERSEND_API_KEY }}" | |
SUMMARY_MAIL_FROM="${{ vars.SUMMARY_MAIL_FROM }}" | |
SUMMARY_MAIL_TO="${{ vars.SUMMARY_MAIL_TO }}" | |
DEV_AUTO_CONFIGURE_PLAYERS=false | |
PUBLIC_DEV_DISABLE_CURSOR_POSITIONS=false | |
- name: Build the project | |
run: pnpm run build | |
- name: Run lints | |
run: pnpm run lint | |
- name: Run checks | |
run: pnpm run check | |
- name: Run tests | |
run: pnpm run test:unit | |
- name: Store artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: webapp-build | |
path: webapp/build | |
deploy-webapp: | |
needs: test-webapp | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# with: | |
# repository: foryouandyourcustomers/the-hidden-threat-built | |
# ref: main | |
- uses: actions/download-artifact@v2 | |
with: | |
name: webapp-build | |
path: webapp-build | |
- name: Push to built repo | |
uses: cpina/github-action-push-to-another-repository@v1.7.2 | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
with: | |
source-directory: 'webapp-build' | |
destination-github-username: 'foryouandyourcustomers' | |
destination-repository-name: 'the-hidden-threat-built' | |
user-email: m@tias.me | |
target-branch: main | |
- name: Trigger redeploy on render.com | |
env: | |
RENDER_DEPLOY_URL: ${{ secrets.RENDER_DEPLOY_URL }} | |
run: curl "$RENDER_DEPLOY_URL" | |
# - name: GIT commit and push all changed files | |
# env: | |
# CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts | |
# CI_COMMIT_AUTHOR: Continuous Integration | |
# run: | | |
# git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | |
# git config --global user.email "username@users.noreply.github.com" | |
# git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}" | |
# git push | |
build-and-push-image: | |
needs: test-webapp | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# We need to checkout the project to get access to the Dockerfile | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# For ease of use, we just copy the Dockerfile to the root of the project | |
- name: Copy Dockerfile | |
run: cp webapp/Dockerfile . | |
# The actual app is in the artifact and will be copied to webapp-build | |
- uses: actions/download-artifact@v2 | |
with: | |
name: webapp-build | |
path: webapp-build | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |