Added config screen #29 (#42) #16
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Deploy static content to Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build_info: | |
runs-on: ubuntu-latest | |
outputs: | |
GITHUB_ACTOR: ${{ steps.create.outputs.GITHUB_ACTOR }} | |
GITHUB_SHA_SHORT: ${{ steps.create.outputs.GITHUB_SHA_SHORT }} | |
COMMIT_URL: ${{ steps.create.outputs.COMMIT_URL }} | |
BUILD_TIMESTAMP: ${{ steps.create.outputs.BUILD_TIMESTAMP }} | |
steps: | |
- id: create | |
name: "@${{ github.actor }} initiated GitHub Pages deployment, prepare build info" | |
run: | | |
# Builder username on GitHub | |
echo "GITHUB_ACTOR=${{ github.actor }}" && echo "GITHUB_ACTOR=${{ github.actor }}" >> "$GITHUB_OUTPUT" | |
# Create short Git SHA equivalent to `$(git rev-parse --short HEAD)` e.g. "d1f5cfd" | |
GITHUB_SHA_SHORT="${GITHUB_SHA::7}" | |
echo "GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT" && echo "GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT" >> "$GITHUB_OUTPUT" | |
# Create commit URL, e.g. "https://github.com/OwnTube-tv/web-client/commit/d1f5cfd" | |
COMMIT_URL="https://github.com/${{ github.repository }}/commit/$GITHUB_SHA_SHORT" | |
echo "COMMIT_URL=$COMMIT_URL" && echo "COMMIT_URL=$COMMIT_URL" >> "$GITHUB_OUTPUT" | |
# Create ISO format build timestamp in UTC, e.g. "2024-02-19T13:12:52Z" | |
BUILD_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
echo "BUILD_TIMESTAMP=$BUILD_TIMESTAMP" && echo "BUILD_TIMESTAMP=$BUILD_TIMESTAMP" >> "$GITHUB_OUTPUT" | |
deploy: | |
needs: build_info | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install Dependencies | |
run: cd OwnTube.tv/ && npm install | |
- name: Check ESLint Code Style | |
run: cd OwnTube.tv/ && npx eslint . | |
- name: Check Prettier Formatting | |
run: cd OwnTube.tv/ && npx prettier --check ../ | |
- name: Run Tests | |
run: cd OwnTube.tv/ && npm run test | |
- name: Inject Build Info | |
run: | | |
# Overwrite build-info.json in source root dir | |
cat <<EOF > ./OwnTube.tv/build-info.json | |
{ | |
"GITHUB_ACTOR": "${{ needs.build_info.outputs.GITHUB_ACTOR }}", | |
"GITHUB_SHA_SHORT": "${{ needs.build_info.outputs.GITHUB_SHA_SHORT }}", | |
"COMMIT_URL": "${{ needs.build_info.outputs.COMMIT_URL }}", | |
"BUILD_TIMESTAMP": "${{ needs.build_info.outputs.BUILD_TIMESTAMP }}" | |
} | |
EOF | |
- name: "Build Web App by @${{ github.actor }}" | |
run: cd OwnTube.tv/ && cat build-info.json && npx expo export --platform web | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload Expo build output | |
path: "./OwnTube.tv/dist/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |