update-info #19

Merged
werewolfkid merged 3 commits from update-info into main 2025-12-30 13:38:39 -05:00
3 changed files with 121 additions and 45 deletions
Showing only changes of commit ae6d88d8a5 - Show all commits

View File

@@ -1,22 +1,24 @@
name: Main # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on: on:
# Trigger the workflow on push or pull request,
push: push:
branches: [main] branches: [main, stable]
pull_request: pull_request:
branches: [main] # These types of PRs
types: [opened, synchronize, reopened]
env:
REGISTRY: gitea.lucids-cove.duckdns.org
OWNER: wkc
IMAGE_NAME: no-twitter-bot-stats
jobs: jobs:
build-and-push-docker-image: build:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
strategy: strategy:
matrix: matrix:
node-version: [20.x] node-version: [20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:
- name: "Base requirements" - name: "Base requirements"
run: | run: |
@@ -25,39 +27,27 @@ jobs:
# ansible collections # ansible collections
ansible-galaxy collection install community.general --force ansible-galaxy collection install community.general --force
ansible-galaxy collection install ansible.posix --force ansible-galaxy collection install ansible.posix --force
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Enable Corepack
run: npm install -g corepack && corepack enable # Corepack
- name: Log into registry ${{ env.REGISTRY }} - name: Install Corepack
uses: docker/login-action@v2 run: npm install -g corepack
with: - name: "Enable Corepack"
registry: ${{ env.REGISTRY }} run: corepack enable
username: ${{ env.OWNER }} - name: "Install Yarn"
password: ${{ secrets.TOKEN }} run: corepack prepare yarn@latest --activate
- name: Docker Hub Login
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin # YARN
- name: Set up QEMU - name: "Install Dependencies"
uses: docker/setup-qemu-action@v2 run: yarn install # will run `yarn install` command
- name: Setup Docker buildx #- uses: borales/actions-yarn@v3.0.0
uses: docker/setup-buildx-action@v2 # with:
- name: Extract Docker metadata # cmd: test # will run `yarn test` command
id: meta #- uses: borales/actions-yarn@v3.0.0
uses: docker/metadata-action@v4 # with:
with: # cmd: type-check # will run `yarn type-check` command
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }} - name: "Lint Repo"
- name: Build and Push Versioned Docker Image run: yarn lint # will run `yarn lint` command
id: build-and-push - name: "Build Code"
uses: docker/build-push-action@v4 run: yarn run build # will run `yarn build` command
if: ${{ github.ref != 'refs/heads/main' }}
with:
context: .
push: ${{ !github.event.pull_request.head.repo.fork }}
tags: ${{ steps.meta.outputs.tags }}
- name: Build and Push Latest Docker Image
id: build-and-push-latest
uses: docker/build-push-action@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:latest

44
.github/workflows/vercel-preview.yaml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Vercel Preview Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
# Trigger the workflow on push or pull request,
# push:
# branches: [main, stable]
pull_request:
# These types of PRs
types: [opened, synchronize, reopened]
jobs:
Deploy-Preview:
runs-on: ubuntu-24.04
steps:
# Setup environment
- name: "Base requirements"
run: |
# packages
apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible
# ansible collections
ansible-galaxy collection install community.general --force
ansible-galaxy collection install ansible.posix --force
- uses: actions/checkout@v2
# Corepack
- name: Install Corepack
run: npm install -g corepack
- name: "Enable Corepack"
run: corepack enable
- name: "Install Yarn"
run: corepack prepare yarn@latest --activate
# Vercel
- uses: actions/checkout@v2
- name: "Install Vercel CLI"
run: npm install --global vercel@latest
- name: "Pull Vercel Environment Information"
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: "Build Project Artifacts"
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: "Deploy Project Artifacts to Vercel"
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

View File

@@ -0,0 +1,42 @@
name: Vercel Production Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches:
- main
- stable
jobs:
Deploy-Production:
runs-on: ubuntu-24.04
steps:
# Setup environment
- name: "Base requirements"
run: |
# packages
apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible
# ansible collections
ansible-galaxy collection install community.general --force
ansible-galaxy collection install ansible.posix --force
- uses: actions/checkout@v2
# Corepack
- name: Install Corepack
run: npm install -g corepack
- name: "Enable Corepack"
run: corepack enable
- name: "Install Yarn"
run: corepack prepare yarn@latest --activate
# Vercel
- name: "Install Vercel CLI"
run: npm install --global vercel@latest
- name: "Pull Vercel Environment Information"
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: "Build Project Artifacts"
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: "Deploy Project Artifacts to Vercel"
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}