renew trigger job #3
This file contains hidden or 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: Development (build-publish) | |
| on: | |
| push: | |
| branches: [ "develop" ] | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '11' | |
| - name: Install Ant and gh CLI | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ant gh curl | |
| - name: Build data package | |
| run: | | |
| ant -lib scripts/libs data-package | |
| - name: Find artifact | |
| id: find | |
| run: | | |
| ART=$(ls dist/baudiData-*.xar 2>/dev/null | head -n1 || true) | |
| if [ -z "$ART" ]; then echo "No artifact found" && exit 1; fi | |
| echo "artifact=$ART" >> $GITHUB_OUTPUT | |
| - name: Publish to this repo as Release asset | |
| env: | |
| TARGET_REPO: ${{ github.repository }} # current repo | |
| TARGET_PAT: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN for same-repo writes | |
| ARTIFACT: ${{ steps.find.outputs.artifact }} | |
| run: | | |
| echo "$TARGET_PAT" | gh auth login --with-token | |
| if ! gh release view dev-latest --repo "$TARGET_REPO" >/dev/null 2>&1; then | |
| gh release create dev-latest "$ARTIFACT" --repo "$TARGET_REPO" --title "BauDi Data (Development)" --notes "Automated publish from CI" --prerelease | |
| else | |
| gh release upload dev-latest "$ARTIFACT" --repo "$TARGET_REPO" --clobber | |
| fi | |
| dispatch: | |
| runs-on: ubuntu-latest | |
| needs: build-publish | |
| steps: | |
| - name: Trigger baudi-docker (Dev) build | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| https://api.github.com/repos/Baumann-Digital/baudi-docker/dispatches \ | |
| -d '{"event_type":"baudi_data_dev_latest","client_payload":{"ref":"'$GITHUB_REF'","commit":"'$GITHUB_SHA'"}}' |