Firq
86b6263ec1
All checks were successful
Linting and checking code / get-version (push) Successful in 2s
Build and deploy preview site / check-tag (push) Successful in 2s
Linting and checking code / astro-check (push) Successful in 12s
Build and deploy preview site / checking (push) Successful in 12s
Build and deploy preview site / build-site (push) Successful in 1m6s
Build and deploy preview site / run-unlighthouse (push) Successful in 0s
Build and deploy preview site / create-release (push) Successful in 5s
Build and deploy preview site / auto-deploy-dockge (push) Successful in 21s
100 lines
3.2 KiB
YAML
100 lines
3.2 KiB
YAML
name: Build and deploy preview site
|
|
run-name: Building and deploying pewview for version ${{ github.ref_name }}
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+\.[0-9]+\.[0-9]+-pre\.[0-9]+'
|
|
|
|
jobs:
|
|
check-tag:
|
|
runs-on: docker
|
|
steps:
|
|
- name: Checking Out Repository Code
|
|
uses: https://code.forgejo.org/actions/checkout@v3
|
|
- name: Check if Version in package.json matches Tag
|
|
run: |
|
|
VERSION=$(npm pkg get version --workspaces=false | tr -d \")
|
|
if test $VERSION != "${{ github.ref_name }}"; then
|
|
echo "Expected Version is: '${{ github.ref_name }}' actual Version is: '$VERSION'";
|
|
exit 1
|
|
else
|
|
echo "Version is: '$VERSION'";
|
|
fi
|
|
|
|
checking:
|
|
needs: [ check-tag ]
|
|
runs-on: docker
|
|
container: forgejo.neshweb.net/ci-docker-images/node-alpine-git:latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: https://code.forgejo.org/actions/checkout@v3
|
|
- name: Install packages
|
|
run: npm i
|
|
- name: Run astro check (linting + static analysis)
|
|
run: npm run astro check
|
|
|
|
build-site:
|
|
needs: [ checking ]
|
|
if: success()
|
|
runs-on: dind
|
|
steps:
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Log into Docker Package Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: forgejo.neshweb.net
|
|
username: ${{ secrets.FORGEJO_USERNAME }}
|
|
password: ${{ secrets.FORGEJO_TOKEN }}
|
|
- name: Build and push to Docker Package Registry
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
push: true
|
|
tags: forgejo.neshweb.net/firq/firq-dev-website:${{ github.ref_name }}, forgejo.neshweb.net/firq/firq-dev-website:preview
|
|
|
|
create-release:
|
|
needs: [ build-site ]
|
|
if: success()
|
|
runs-on: docker
|
|
steps:
|
|
- name: Release New Version
|
|
uses: https://code.forgejo.org/actions/forgejo-release@v1
|
|
with:
|
|
direction: upload
|
|
url: https://forgejo.neshweb.net
|
|
release-dir: release
|
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
|
tag: ${{ github.ref_name }}
|
|
prerelease: true
|
|
|
|
auto-deploy-dockge:
|
|
needs: [ build-site ]
|
|
if: success()
|
|
runs-on: docker
|
|
container: forgejo.neshweb.net/firq/dockge-cli:0.1.2
|
|
steps:
|
|
- name: Configure Dockge CLI
|
|
run: |
|
|
dockge host '${{ vars.DOCKGE_HOST }}'
|
|
dockge login --user '${{ secrets.DOCKGE_USER }}' --password '${{ secrets.DOCKGE_CREDENTIAL }}'
|
|
- name: Check status and redeploy
|
|
run: |
|
|
dockge status firq-dev-preview
|
|
dockge update firq-dev-preview
|
|
dockge status firq-dev-preview
|
|
|
|
run-unlighthouse:
|
|
needs: [ build-site ]
|
|
if: success()
|
|
runs-on: docker
|
|
steps:
|
|
- name: Launch workflow
|
|
run: |
|
|
payload="{\"ref\": \"${GITHUB_REF_NAME}\", \"inputs\": { \"containertag\": \"${GITHUB_REF_NAME}\" }}"
|
|
curl -X "POST" \
|
|
-H "accept: application/json" \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
-d "${payload}" \
|
|
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/workflows/unlighthouse.yml/dispatches" -v
|