Skip to content

Commit

Permalink
Fixed updating the library version in the CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
barshaul committed Feb 15, 2024
1 parent b17a77f commit 423e18d
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 12 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
name: Continuous Deployment

on:
pull_request:
paths:
- .github/workflows/npm-cd.yml
- .github/workflows/build-node-wrapper/action.yml
push:
tags:
- "v*.*"
Expand Down Expand Up @@ -56,7 +60,8 @@ jobs:
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
export version=`if ${{ github.event_name == 'pull_request' }}; then echo '255.255.255'; else echo ${GITHUB_REF:11}; fi`
echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV
- name: Setup node
if: matrix.build.NPM_PUBLISH == true
Expand All @@ -68,7 +73,14 @@ jobs:
scope: "${{ vars.NPM_SCOPE }}"
always-auth: true
token: ${{ secrets.NPM_AUTH_TOKEN }}


- name: Update package version in config.toml
uses: ./.github/workflows/update-glide-version
with:
folder_path: "${{ github.workspace }}/node/rust-client/.cargo"
version: ${{ env.RELEASE_VERSION }}
named_os: ${{ matrix.build.NAMED_OS }}

- name: Build Node wrapper
if: matrix.build.NPM_PUBLISH == true
uses: ./.github/workflows/build-node-wrapper
Expand All @@ -82,7 +94,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to NPM
if: matrix.build.NPM_PUBLISH == true
if: matrix.build.NPM_PUBLISH == true && github.event_name != 'pull_request'
shell: bash
working-directory: ./node
run: |
Expand Down Expand Up @@ -190,6 +202,7 @@ jobs:
done
- name: Publish the base package
if: github.event_name != 'pull_request'
shell: bash
working-directory: ./node/npm/glide
run: |
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
name: Continuous Deployment

on:
pull_request:
paths:
- .github/workflows/pypi-cd.yml
- .github/workflows/build-python-wrapper/action.yml
push:
tags:
- "v*.*"
Expand Down Expand Up @@ -56,7 +60,8 @@ jobs:
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
export version=`if ${{ github.event_name == 'pull_request' }}; then echo '255.255.255'; else echo ${GITHUB_REF:11}; fi`
echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV
- name: Set the package version for Python
if: matrix.build.PYPI_PUBLISH == true
Expand Down Expand Up @@ -85,6 +90,13 @@ jobs:
sudo apt upgrade -y
sudo apt install python3 python3-venv python3-pip -y
- name: Update package version in config.toml
uses: ./.github/workflows/update-glide-version
with:
folder_path: "${{ github.workspace }}/python/.cargo"
version: ${{ env.RELEASE_VERSION }}
named_os: ${{ matrix.build.NAMED_OS }}

- name: Build Python wrapper
if: matrix.build.PYPI_PUBLISH == true
uses: ./.github/workflows/build-python-wrapper
Expand All @@ -104,7 +116,7 @@ jobs:
cat .gitignore
- name: Build Python wheels (linux)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux')
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux') && github.event_name != 'pull_request'
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
Expand All @@ -125,7 +137,7 @@ jobs:
fi
- name: Build Python wheels (macos)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin')
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin') && github.event_name != 'pull_request'
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
Expand All @@ -141,6 +153,7 @@ jobs:
if-no-files-found: error

publish-to-pypi:
if: github.event_name != 'pull_request'
name: Publish the base PyPi package
runs-on: ubuntu-latest
needs: publish-binaries
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/update-glide-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Update GLIDE version in the config.toml file

inputs:
folder_path:
description: "The folder path of the config.toml file"
required: true
type: string
named_os:
description: "The name of the current operating system"
required: false
default: "linux"
type: string
options:
- linux
- darwin
runs:
using: "composite"
steps:
- name: Update package version in config.toml
working-directory: ${{ inputs.folder_path }}
shell: bash
run: |
SED_FOR_MACOS=`if ${{ inputs.named_os == 'darwin' }}; then echo "''"; fi`
sed -i $SED_FOR_MACOS "s|unkown|${{ env.RELEASE_VERSION }}|g" ./config.toml
# log the config.toml file
cat ./config.toml
2 changes: 1 addition & 1 deletion benchmarks/rust/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = "Glide" # This should be overwritten by each wrapper library.
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion csharp/lib/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlideC#", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion glide-core/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = "Glide" # This should be overwritten by each wrapper library.
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion java/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlideJava", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion node/rust-client/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlideJS", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion python/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlidePy", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"

0 comments on commit 423e18d

Please sign in to comment.