69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
name: Tomcode landing build/deploy
|
|
run-name: Tomcode landing is being built and deployed 🚀
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
name: build
|
|
runs-on: node
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Download dependencies
|
|
run: |
|
|
echo "Downloading dependencies."
|
|
npm ci --cache .npm --prefer-offline
|
|
- name: Build
|
|
run: |
|
|
echo "Building application."
|
|
pwd
|
|
npm run build --cache .npm --prefer-offline
|
|
- name: Upload application artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build
|
|
path: ./build
|
|
dockerize:
|
|
name: dockerize
|
|
needs: build
|
|
runs-on: host
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Download application artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build
|
|
path: ./build
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker BuildX
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
config-inline: |
|
|
[registry."git.tomcode.io"]
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: https://git.tomcode.io
|
|
username: ${{ vars.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Get Meta
|
|
run: |
|
|
pwd && ls -la
|
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
|
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: ./
|
|
file: ./docker/Dockerfile
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
push: true
|
|
tags: | # replace it with your local IP and tags
|
|
git.tomcode.io/tomcode/landing:latest |