fgo-ta-com-website/.forgejo/workflows/build_preview.yml

67 lines
2.1 KiB
YAML
Raw Normal View History

2024-01-03 00:18:53 +00:00
on:
push:
tags:
2024-04-30 23:37:29 +00:00
- '[0-9]+\.[0-9]+\.[0-9]+-pre\.[0-9]+'
2024-01-03 00:18:53 +00:00
jobs:
2024-07-18 19:29:12 +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: |
VERSION=$(cat package.json | grep "version" | sed 's/.*://' | tr -d , | tr -d \" | 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
2024-01-03 00:18:53 +00:00
checking:
2024-07-18 19:29:12 +00:00
needs: [ check-tag ]
2024-01-03 00:18:53 +00:00
runs-on: docker
2024-07-18 19:57:59 +00:00
container: forgejo.neshweb.net/ci-docker-images/node-alpine-git:1
2024-01-03 00:18:53 +00:00
steps:
- name: Checkout source code
uses: https://code.forgejo.org/actions/checkout@v3
- name: Install packages
2024-07-18 19:29:12 +00:00
run: npm i
2024-01-03 00:18:53 +00:00
- name: Run astro check (linting + static analysis)
run: npm run astro check
build-site:
2024-07-18 19:29:12 +00:00
needs: [ checking ]
2024-01-03 00:18:53 +00:00
if: success()
runs-on: dind
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2024-07-18 19:29:12 +00:00
- name: Log into Docker Package Registry
2024-01-03 00:18:53 +00:00
uses: docker/login-action@v3
with:
registry: forgejo.neshweb.net
username: ${{ secrets.FORGEJO_USERNAME }}
password: ${{ secrets.FORGEJO_TOKEN }}
2024-07-18 19:29:12 +00:00
- name: Build and push to Docker Package Registry
2024-01-03 00:18:53 +00:00
uses: docker/build-push-action@v5
with:
push: true
tags: forgejo.neshweb.net/firq/fgo-ta-com-website:${{ github.ref_name }}, forgejo.neshweb.net/firq/fgo-ta-com-website:preview
2024-07-18 19:29:12 +00:00
create-release:
needs: [ build-site ]
2024-01-03 00:18:53 +00:00
if: success()
runs-on: docker
steps:
- name: Release New Version
2024-01-10 09:32:53 +00:00
uses: https://code.forgejo.org/actions/forgejo-release@v1
2024-01-03 00:18:53 +00:00
with:
direction: upload
url: https://forgejo.neshweb.net
release-dir: release
token: ${{ secrets.FORGEJO_TOKEN }}
tag: ${{ github.ref_name }}
2024-01-03 18:36:07 +00:00
prerelease: true