99 lines
3.1 KiB
YAML
99 lines
3.1 KiB
YAML
# .gitea/workflows/build.yaml
|
|
|
|
name: Build Crate
|
|
run-name: Build
|
|
|
|
on: [push]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
# TODO -> Change to actions/checkout@v3 once this is resolved https://github.com/actions/checkout/issues/1370
|
|
uses: https://gitea.com/ScMi1/checkout@v1
|
|
- name: Get rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
components: rustfmt, clippy
|
|
override: true
|
|
- name: Add wasm32 to cargo
|
|
run: rustup target add wasm32-unknown-unknown
|
|
- name: Cache rust
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: "true"
|
|
- name: Install perseus
|
|
uses: baptiste0928/cargo-install@v2
|
|
with:
|
|
crate: perseus-cli
|
|
- name: Install npm
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: latest
|
|
- name: Install sass
|
|
run: npm install -g sass
|
|
- name: Install tailwindcss via npm
|
|
run: npm install -D tailwindcss
|
|
- name: Compile css
|
|
run: npm run build
|
|
- name: Build the project
|
|
run: perseus deploy
|
|
- name: Download private docker registry cert
|
|
uses: nicklasfrahm/scp-action@v1.0.1
|
|
with:
|
|
direction: download
|
|
host: ${{ secrets.REGISTRY_HOST }}
|
|
username: ${{ secrets.REGISTRY_HOST_USERNAME }}
|
|
insecure_password: ${{ secrets.REGISTRY_HOST_PASSWORD }}
|
|
source: ${{ secrets.REGISTRY_CRT_PATH }}
|
|
target: ca.crt
|
|
insecure_ignore_fingerprint: true
|
|
|
|
- name: Add directory for docker registry cert
|
|
run: 'mkdir -p /etc/docker/certs.d/${{ secrets.REGISTRY_HOST }}'
|
|
|
|
- name: Move private docker registry cert
|
|
run: 'mv ca.crt /etc/docker/certs.d/${{ secrets.REGISTRY_HOST }}'
|
|
|
|
- name: Install docker
|
|
uses: papodaca/install-docker-action@main
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
config-inline: |
|
|
[registry."${{ secrets.REGISTRY_HOST }}"]
|
|
insecure = true
|
|
ca=["/etc/docker/certs.d/${{ secrets.REGISTRY_HOST }}/ca.crt"]
|
|
|
|
- name: Login to private docker registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ secrets.REGISTRY_HOST }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ secrets.REGISTRY_HOST }}/test/test:${{ gitea.ref_name }}
|
|
|
|
- name: Trigger deployment
|
|
uses: fjogeleit/http-request-action@v1
|
|
with:
|
|
url: ${{ secrets.TRIGGER_DEPLOY_URL }}
|
|
method: POST
|
|
customHeaders: '{"Content-Type": "application/json"}'
|
|
data: '{"actionName": "deploy", "arguments": []}'
|
|
preventFailureOnNoResponse: 'true'
|