2024-10-26 12:14:10 +00:00
|
|
|
name: Build and deploy preview site
|
|
|
|
run-name: Building and deploying pewview for version ${{ github.ref_name }}
|
2023-12-20 23:16:39 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2024-06-15 17:30:25 +00:00
|
|
|
- '[0-9]+\.[0-9]+\.[0-9]+-pre\.[0-9]+'
|
2023-12-20 23:16:39 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-07-19 20:52:15 +00:00
|
|
|
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: |
|
2024-07-20 13:59:15 +00:00
|
|
|
VERSION=$(npm pkg get version --workspaces=false | tr -d \")
|
2024-07-19 20:52:15 +00:00
|
|
|
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
|
|
|
|
|
2023-12-20 23:16:39 +00:00
|
|
|
checking:
|
2024-07-19 20:52:15 +00:00
|
|
|
needs: [ check-tag ]
|
2023-12-20 23:16:39 +00:00
|
|
|
runs-on: docker
|
2024-07-19 20:52:15 +00:00
|
|
|
container: forgejo.neshweb.net/ci-docker-images/node-alpine-git:latest
|
2023-12-20 23:16:39 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
|
|
|
uses: https://code.forgejo.org/actions/checkout@v3
|
|
|
|
- name: Install packages
|
2024-07-19 20:52:15 +00:00
|
|
|
run: npm i
|
2023-12-20 23:16:39 +00:00
|
|
|
- name: Run astro check (linting + static analysis)
|
|
|
|
run: npm run astro check
|
|
|
|
|
|
|
|
build-site:
|
2024-07-19 20:52:15 +00:00
|
|
|
needs: [ checking ]
|
2023-12-20 23:16:39 +00:00
|
|
|
if: success()
|
|
|
|
runs-on: dind
|
|
|
|
steps:
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-07-19 20:52:15 +00:00
|
|
|
- name: Log into Docker Package Registry
|
2023-12-20 23:16:39 +00:00
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: forgejo.neshweb.net
|
|
|
|
username: ${{ secrets.FORGEJO_USERNAME }}
|
|
|
|
password: ${{ secrets.FORGEJO_TOKEN }}
|
2024-07-19 20:52:15 +00:00
|
|
|
- name: Build and push to Docker Package Registry
|
2023-12-20 23:16:39 +00:00
|
|
|
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
|
|
|
|
|
2024-07-19 20:52:15 +00:00
|
|
|
create-release:
|
|
|
|
needs: [ build-site ]
|
2023-12-20 23:16:39 +00:00
|
|
|
if: success()
|
|
|
|
runs-on: docker
|
|
|
|
steps:
|
|
|
|
- name: Release New Version
|
2024-01-10 10:38:38 +00:00
|
|
|
uses: https://code.forgejo.org/actions/forgejo-release@v1
|
2023-12-20 23:16:39 +00:00
|
|
|
with:
|
|
|
|
direction: upload
|
|
|
|
url: https://forgejo.neshweb.net
|
|
|
|
release-dir: release
|
|
|
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
|
|
|
tag: ${{ github.ref_name }}
|
2024-01-10 10:38:38 +00:00
|
|
|
prerelease: true
|
2023-12-20 23:16:39 +00:00
|
|
|
|
2024-07-20 16:02:22 +00:00
|
|
|
auto-deploy-dockge:
|
|
|
|
needs: [ build-site ]
|
|
|
|
if: success()
|
|
|
|
runs-on: docker
|
2024-10-01 21:27:27 +00:00
|
|
|
container: forgejo.neshweb.net/firq/dockge-cli:0.1.2
|
2024-07-20 16:02:22 +00:00
|
|
|
steps:
|
|
|
|
- name: Configure Dockge CLI
|
|
|
|
run: |
|
2024-07-22 10:46:57 +00:00
|
|
|
dockge host '${{ vars.DOCKGE_HOST }}'
|
2024-07-20 16:02:22 +00:00
|
|
|
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
|
2024-10-22 17:59:19 +00:00
|
|
|
|
|
|
|
run-unlighthouse:
|
2024-10-22 18:00:14 +00:00
|
|
|
needs: [ build-site ]
|
|
|
|
if: success()
|
2024-10-22 17:59:19 +00:00
|
|
|
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
|