Skip to content

Commit

Permalink
Add workflow to publish graphql client to central on release
Browse files Browse the repository at this point in the history
- Add functionality to automatically update version numbers
  • Loading branch information
rukmal committed Sep 27, 2022
1 parent 954ee5d commit b1c6da4
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 710 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
args: test
env:
WORKING_DIR: api
generate-graphql-client-job:
generate-graphql-client:
name: Generate GraphQL Client
needs: api-test
runs-on: ubuntu-22.04
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,36 @@ on:
- "published"

jobs:
update-version:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set output
id: vars
# See: https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
run: echo ::set-output name=tag::${GITHUB_REF#refs/v*/}
- name: Update API version in package files
uses: ciiiii/toml-editor@1.0.0
with:
file: api/Ballerina.toml
key: "package.version"
value: ${{ steps.vars.outputs.tag }}
- name: Update client version in package files
uses: ciiiii/toml-editor@1.0.0
with:
file: client/Ballerina.toml
key: "package.version"
value: ${{ steps.vars.outputs.tag }}
- name: Commit version changes to repository
uses: EndBug/add-and-commit@v9 # See: https://github.com/marketplace/actions/add-commit
with:
add: "."
default_author: github_actions
message: "[GitHub Actions] Commit version updates"
update-staging-db:
name: Update Azure staging database
needs: update-version
runs-on: ubuntu-22.04
environment: Staging
permissions:
Expand All @@ -26,3 +54,22 @@ jobs:
USER: ${{ secrets.DB_USER }}
PASSWORD: ${{ secrets.DB_PASSWORD }}
DATABASE: ${{ secrets.DB_DATABASE }}
push-api-client:
name: Publish GraphQL API Client
needs: update-staging-db
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build distribution archive of client package
uses: ballerina-platform/ballerina-action@394eb82cc07e020948fee8d1474143ae393147f4
with:
args: pack
env:
WORKING_DIR: client
- name: Push to central
uses: ballerina-platform/ballerina-action@394eb82cc07e020948fee8d1474143ae393147f4
with:
args: push
1 change: 1 addition & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
Dependencies.toml
Loading

0 comments on commit b1c6da4

Please sign in to comment.