Update GitHub Actions #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to releases.slint.dev | |
on: | |
push: | |
paths: 'releases/**' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./releases | |
outputs: | |
version: ${{ steps.identify-version.outputs.version }} | |
steps: | |
- name: Repository Checkout | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
releases | |
- name: Identify Version | |
id: identify-version | |
run: | | |
echo "version=$(sed -n '1p' ./releases/versions.txt)" >> "$GITHUB_OUTPUT" | |
- name: npm install | |
run: | | |
npm install | |
- name: Generate a token | |
id: app-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.READ_WRITE_APP_ID }} | |
private-key: ${{ secrets.READ_WRITE_PRIVATE_KEY }} | |
repositories: website | |
- name: Clone website directory | |
uses: actions/checkout@v4 | |
with: | |
repository: slint-ui/website | |
ref: prod | |
path: releases/website | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Generate docs.html and 404.html | |
run: | | |
mkdir -p website/output | |
cd website && go run generator/generator.go -skip-agreements | |
- name: Copy docs.html and 404.html | |
run: | | |
cp website/output/docs.html index.html | |
cp website/output/404.html 404.html | |
rm -rf website | |
- name: Install Netlify | |
run: | | |
npm install netlify-cli --save-dev | |
- name: Install Dependencies | |
run: | | |
npm ci | |
- name: Deploy to Netlify | |
id: netlify_deploy | |
run: | | |
netlify deploy \ | |
--dir . \ | |
--site ${{ secrets.NETLIFY_RELEASES_SITE_ID }} \ | |
--auth ${{ secrets.NETLIFY_API_TOKEN }} \ | |
--prod | |
- name: Update website | |
uses: slint-ui/www/.github/actions/prod-deployment.yml | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
scrape-docs: | |
uses: ./.github/workflows/typesense-scrape.yml | |
needs: build-and-deploy | |
with: | |
version: ${{ needs.build-and-deploy.outputs.version }} |