deploy #20
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 | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 18 * * *" | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
YT_API_KEY: ${{ secrets.YT_API_KEY }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up git | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
- name: Create or switch to gh-pages branch | |
run: | | |
if git ls-remote --exit-code --heads origin gh-pages; then | |
echo "Branch exists, checking out..." | |
git fetch --all | |
git checkout gh-pages | |
curl -L https://raw.githubusercontent.com/clitic/music/refs/heads/main/index.html -o index.html | |
else | |
echo "Branch does not exist, creating..." | |
git checkout -b gh-pages | |
rm -r .github .gitignore src Cargo.toml | |
fi | |
- name: Install music | |
run: cargo install --git https://github.com/clitic/music | |
- name: Run music | |
run: /home/runner/.cargo/bin/music | |
- name: Commit and push changes to gh-pages | |
run: | | |
git add -A | |
git commit -am "automatic deploy" | |
git push origin gh-pages |