Skip to content

Publish

Publish #1269

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Publish
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
schedule:
- cron: 0 0 * * *
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches - needed for the worktree with `public`
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
with:
ruby-version: 2.6 # Not needed with a .ruby-version file
- run: bundle install
# Insert secrets into environment
- run: |
touch .env
echo "GITHUB_USERNAME=${{ secrets.FSH_FINDER_USERNAME }}" >> .env
echo "GITHUB_TOKEN=${{ secrets.FSH_FINDER_TOKEN }}" >> .env
- run: |
touch ssh_key
echo "${{ secrets.FSH_FINDER_DEPLOY_KEY }}" > ssh_key
# Builds the output file
- run: script/run
# Deploy the output
- run: |
# Deploy
git config --global user.email "[email protected]"
git config --global user.name "FSH Finder Build"
git worktree add public/ public
rm -rf generated/repo_data
cp generated/* public/
mv public/cache.json public/fshy_repos.json
cd public
git add -A
git commit -m "Update site"
GIT_SSH_COMMAND='ssh -i ' git push -u origin public
cd ..
git worktree remove public