publish #14
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: publish | |
on: | |
schedule: | |
# Every day at 11:45 | |
- cron: "45 11 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: s21toolkit/s21introspector | |
path: s21introspector | |
- env: | |
S21_USERNAME: ${{ secrets.S21_USERNAME }} | |
S21_PASSWORD: ${{ secrets.S21_PASSWORD }} | |
run: | | |
rm -rf ./schema | |
./s21introspector/bin/main.ts @ $(./s21introspector/bin/main.ts auth $S21_USERNAME $S21_PASSWORD) --isolate-operations -o ./schema | |
- id: diff | |
run: | | |
if [ "$(git add --all --dry-run ./schema | head -1 | wc -l)" -eq 1 ]; then | |
echo "changed=true" >> $GITHUB_OUTPUT; | |
echo "version=$(./s21introspector/bin/main.ts static -n -s PRODUCT_VERSION)" >> $GITHUB_OUTPUT; | |
else | |
echo "changed=false" >> $GITHUB_OUTPUT; | |
fi | |
- if: steps.diff.outputs.changed == 'true' | |
env: | |
VERSION: ${{ steps.diff.outputs.version }} | |
run: | | |
git config user.name s21toolkit | |
git config user.email [email protected] | |
git add ./schema | |
git commit -m "feat(schema): $VERSION" | |
git push | |
git tag "v/$VERSION" | |
git push --tags |