Release Ruby SDK Gem #29
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 Ruby SDK Gem | |
| on: [workflow_dispatch] | |
| jobs: | |
| release-version: | |
| runs-on: ubuntu-latest | |
| name: Release sdk | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - id: checkout | |
| name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.FATTUREINCLOUD_BOT_TOKEN }} | |
| - id: init-git | |
| name: Init GIT | |
| run: | | |
| git config --global user.email "info@fattureincloud.it" | |
| git config --global user.name "fattureincloud-bot" | |
| - id: setup-node | |
| name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| - id: setup-ruby | |
| name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| ruby-version: 3.1.0 | |
| - id: setup-libraries | |
| name: Install libraries | |
| run: | | |
| npm install -g yarn | |
| yarn global add standard-version | |
| wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq | |
| chmod +x /usr/local/bin/yq | |
| yq --version | |
| cd ./scripts/ | |
| yarn | |
| # We read the version from the sdk-version.yaml file and create the tag | |
| # If it is needed to bump version, launch the related workflow | |
| - id: read-ruby-sdk-version | |
| name: Read Ruby SDK version | |
| run: | | |
| SDK_VERSION=$(yq e '.info.version' ./sdk-version.yaml) | |
| echo "Releasing version: $SDK_VERSION" | |
| echo "sdk_version=$SDK_VERSION" >> $GITHUB_ENV | |
| # Here we use standard-version just to generate the changelog | |
| - id: generate-changelog | |
| name: Generate Changelog | |
| run: | | |
| standard-version --skip.bump --skip.tag | |
| - id: git-push | |
| name: Pushing to Git repo | |
| if: ${{ !env.ACT }} | |
| run: | | |
| git push origin | |
| - id: save-commit-sha | |
| name: Save latest commit sha | |
| run: | | |
| COMMIT_SHA=$(git rev-parse HEAD) | |
| echo "commit_sha=$COMMIT_SHA" >> $GITHUB_ENV | |
| - id: create-tag | |
| name: Create tag | |
| if: ${{ !env.ACT }} | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/v${{ env.sdk_version }}", | |
| sha: "${{ env.commit_sha }}" | |
| }) | |
| - id: configure-rubygems | |
| name: Configure RubyGems credentials | |
| if: ${{ !env.ACT }} | |
| uses: rubygems/configure-rubygems-credentials@v2.0.0 | |
| - id: publish | |
| name: Push to rubygems.org | |
| if: ${{ !env.ACT }} | |
| run: | | |
| gem build *.gemspec | |
| gem push *.gem |