|
| 1 | +name: Release Create |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + |
| 7 | +env: |
| 8 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 9 | + |
| 10 | +jobs: |
| 11 | + check-release-conditions: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + if: | |
| 14 | + github.event.pull_request.merged == true && |
| 15 | + github.event.pull_request.base.ref == 'main' && |
| 16 | + startsWith(github.event.pull_request.head.ref, 'release/v') && |
| 17 | + startsWith(github.event.pull_request.user.login, 'github-actions') |
| 18 | +
|
| 19 | + steps: |
| 20 | + - name: Check release conditions |
| 21 | + run: | |
| 22 | + echo "All conditions have been met!" |
| 23 | +
|
| 24 | + create-release: |
| 25 | + permissions: |
| 26 | + contents: write |
| 27 | + needs: check-release-conditions |
| 28 | + runs-on: ubuntu-latest |
| 29 | + |
| 30 | + env: |
| 31 | + NEXT_RELEASE_TAG: ${{ github.event.pull_request.head.ref }} |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Prepare Python |
| 37 | + uses: actions/setup-python@v5 |
| 38 | + with: |
| 39 | + cache: 'pip' |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: pip install -r ./tools/release/requirements.txt |
| 43 | + |
| 44 | + - name: Extract Tag from branch name |
| 45 | + run: | |
| 46 | + NEXT_RELEASE_TAG=$(echo $NEXT_RELEASE_TAG | sed 's/^release\///') |
| 47 | + echo "NEXT_RELEASE_TAG=${NEXT_RELEASE_TAG}" >> $GITHUB_ENV |
| 48 | +
|
| 49 | + - name: Target release Tag |
| 50 | + run: echo "New tag $NEXT_RELEASE_TAG" |
| 51 | + |
| 52 | + - name: Setup Ninja |
| 53 | + run: sudo apt-get install ninja-build |
| 54 | + |
| 55 | + - name: Build singleheader |
| 56 | + run: | |
| 57 | + cmake -DLEXER_TESTING=OFF -G Ninja -B build |
| 58 | + cmake --build build --target lexer-singleheader-lib |
| 59 | +
|
| 60 | + - name: Create singleheader.zip |
| 61 | + run: | |
| 62 | + cd build/singleheader |
| 63 | + zip singleheader.zip lexer.h lexer.cpp |
| 64 | + mv singleheader.zip ../../singleheader/ |
| 65 | + cp lexer.h lexer.cpp ../../singleheader/ |
| 66 | +
|
| 67 | + - name: Create release |
| 68 | + run: ./tools/release/create_release.py |
0 commit comments