|
| 1 | +name: Release on Version Change |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'VERSION' |
| 7 | + - 'client/pyproject.toml' |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + release-server: |
| 13 | + if: contains(github.event.commits[*].modified, 'VERSION') |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Get server version number |
| 21 | + id: get_server_version |
| 22 | + run: | |
| 23 | + SERVER_VERSION=$(cat VERSION) |
| 24 | + echo "SERVER_VERSION=$SERVER_VERSION" > $GITHUB_ENV |
| 25 | +
|
| 26 | + - name: Create Git tag for server |
| 27 | + run: | |
| 28 | + git config --global user.name "github-actions[bot]" |
| 29 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 30 | + git tag "astra-assistants-api-server-${{ env.SERVER_VERSION }}" |
| 31 | + git push origin "astra-assistants-api-server-${{ env.SERVER_VERSION }}" |
| 32 | +
|
| 33 | + - name: Create GitHub Release for server |
| 34 | + uses: actions/create-release@v1 |
| 35 | + with: |
| 36 | + tag_name: "server-${{ env.SERVER_VERSION }}" |
| 37 | + release_name: "Astra Assistants (server) Release: ${{ env.SERVER_VERSION }}" |
| 38 | + body: "Automated release for astra-assistants server ${{ env.SERVER_VERSION }}" |
| 39 | + draft: false |
| 40 | + prerelease: false |
| 41 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + |
| 43 | + release-client: |
| 44 | + if: contains(github.event.commits[*].modified, 'client/pyproject.toml') |
| 45 | + runs-on: ubuntu-latest |
| 46 | + |
| 47 | + steps: |
| 48 | + - name: Checkout code |
| 49 | + uses: actions/checkout@v3 |
| 50 | + |
| 51 | + - name: Get client version number |
| 52 | + id: get_client_version |
| 53 | + run: | |
| 54 | + CLIENT_VERSION=$(grep '^version =' client/pyproject.toml | sed 's/version = "//g' | sed 's/"//g') |
| 55 | + echo "CLIENT_VERSION=$CLIENT_VERSION" > $GITHUB_ENV |
| 56 | +
|
| 57 | + - name: Create Git tag for client |
| 58 | + run: | |
| 59 | + git config --global user.name "github-actions[bot]" |
| 60 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 61 | + git tag "astra-assistants-client-${{ env.CLIENT_VERSION }}" |
| 62 | + git push origin "astra-assistants-client-${{ env.CLIENT_VERSION }}" |
| 63 | +
|
| 64 | + - name: Create GitHub Release for client |
| 65 | + uses: actions/create-release@v1 |
| 66 | + with: |
| 67 | + tag_name: "client-${{ env.CLIENT_VERSION }}" |
| 68 | + release_name: "astra-assistants (client) release ${{ env.CLIENT_VERSION }}" |
| 69 | + body: "Automated release for client version ${{ env.CLIENT_VERSION }}" |
| 70 | + draft: false |
| 71 | + prerelease: false |
| 72 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + |
0 commit comments