Reload Library #690
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: Reload Library | |
run-name: Reload Library | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
jobs: | |
reload: | |
runs-on: self-hosted | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Checkout Library | |
uses: actions/checkout@v3 | |
with: | |
path: lib | |
- name: Checkout Assets | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ vars.ASSETS_REPOSITORY }} | |
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
path: assets | |
- name: Build Internal | |
run: | | |
go version; | |
cd $GITHUB_WORKSPACE/lib/internal/gen-assets-json-file && go build -o gen-json; | |
cd $GITHUB_WORKSPACE/lib/internal/gen-static-assets && go build -o gen-static; | |
- name: Generate Assets | |
run: | | |
cd $GITHUB_WORKSPACE/assets && $GITHUB_WORKSPACE/lib/internal/gen-assets-json-file/gen-json -o assets.json ${{ vars.ASSETS_DIRECTORIES }}; | |
mv assets.json $GITHUB_WORKSPACE/lib/assets.json; | |
cd $GITHUB_WORKSPACE/lib && internal/gen-static-assets/gen-static -i assets.json -b "${{ vars.ASSETS_BASE_URL }}"; | |
- name: Cleanup | |
run: | | |
rm $GITHUB_WORKSPACE/lib/assets.json; | |
rm $GITHUB_WORKSPACE/lib/internal/gen-assets-json-file/gen-json; | |
rm $GITHUB_WORKSPACE/lib/internal/gen-static-assets/gen-static; | |
- name: Commit Library Updates | |
run: | | |
cd $GITHUB_WORKSPACE/lib; | |
git config user.name "${{ github.actor }}"; | |
git config user.email "${{ github.actor_id }}"; | |
git add .; | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "no changes"; | |
else | |
git commit -m "updated assets"; | |
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/olachat/go-oss.git; | |
fi; |