Merge pull request #8 from The-Young-boy/master #14
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: Release – SQLite DB | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| if: > | |
| (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || | |
| (github.event_name == 'push' && github.ref == 'refs/heads/master') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Java 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }} | |
| - name: Build project and export SQLite DB | |
| run: | | |
| ./gradlew :generator:build --quiet | |
| ./gradlew :generator:jvmRun \ | |
| -DmainClass=io.github.kdroidfilter.database.generator.SqlLiteExtractorKt \ | |
| --quiet | |
| ls -l generator/build/policies.db | |
| - name: Define release name | |
| id: relname | |
| run: echo "RELEASE_NAME=$(date +'%Y%m%d%H%M')" >> $GITHUB_ENV | |
| - name: Create and push tag | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "github-actions@users.noreply.github.com" | |
| git fetch --prune | |
| git tag "${{ env.RELEASE_NAME }}" "${{ github.sha }}" | |
| git push origin "${{ env.RELEASE_NAME }}" | |
| - name: Create GitHub release and upload artifact | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.RELEASE_NAME }} | |
| name: ${{ env.RELEASE_NAME }} | |
| files: generator/build/policies.db |