Build/Deploy #1906
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: Build/Deploy | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: {} | |
push: | |
branches: | |
- main | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: "0 12 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Rebuild the site | |
run: | | |
git clone https://github.com/openstack-charmers/charmed-openstack-info | |
sudo snap install --channel latest/edge charmhub-lp-tool | |
git rm report/builds/*.html || true | |
git rm report/charmhub/*.html || true | |
echo "${{ secrets.LP_CREDENTIALS }}" | base64 -d > lp-credentials.txt | |
export LP_CREDENTIALS_FILE=$(pwd)/lp-credentials.txt | |
./gen-reports.sh | |
env: | |
# Generate a valid a macaroon with running: | |
# $ charmcraft login --export=secrets.auth --permission=account-view-packages --permission=package-view --ttl=$((265 * 24 60)) # 1 year | |
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }} | |
- name: Commit changes to data file | |
run: | | |
set -euo pipefail | |
git remote set-url origin https://x-access-token:"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git | |
git config --global user.email "[email protected]" | |
git config --global user.name "actions" | |
git checkout $GITHUB_REF_NAME | |
git add report/ | |
git commit -m "data: refresh release reports" && git push --set-upstream origin $GITHUB_REF_NAME || true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy to Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./report |