Skip to content

Javascript Wrapper Release #34

Javascript Wrapper Release

Javascript Wrapper Release #34

Workflow file for this run

name: Javascript Wrapper Release
on:
workflow_call:
inputs:
cliTag:
description: 'CLI tag name'
required: false
type: string
default: 2.0.0-nightly
jsTag:
description: 'JS Wrapper tag name'
required: false
type: string
default: nightly
dev:
description: 'Is dev build'
required: false
default: false
type: boolean
branch:
description: 'Branch to run npm version patch on'
required: false
default: npm-version-patch
type: string
workflow_dispatch:
inputs:
cliTag:
description: 'CLI tag name (ignored if not dev build)'
required: false
jsTag:
description: 'Tag name (ignored if not dev build)'
required: false
type: string
dev:
description: 'Is dev build'
required: false
default: false
type: boolean
branch:
description: 'Branch to run npm version patch on'
required: false
default: npm-version-patch
type: string
permissions:
id-token: write
contents: write
packages: write
pull-requests: write
jobs:
delete:
uses: tamarleviCm/checkVersion/.github/workflows/delete-packages-and-releases.yml@main
with:
tag: ${{ inputs.jsTag }}
secrets: inherit
if: inputs.dev == true
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.TAMAR_PAT }}
steps:
# CHECKOUT PROJECT
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Create or Checkout Branch
# run: |
# git fetch origin
# if git show-ref --verify --quiet refs/heads/${{ inputs.branch }}; then
# git checkout ${{ inputs.branch }}
# git pull
# else
# git checkout -b ${{ inputs.branch }} origin/main
# fi
# GIT CONFIGURATION
- run: |
git config user.name github-actions
git config user.email [email protected]
# SETUP NODE
- uses: actions/[email protected]
with:
node-version: 10
registry-url: https://npm.pkg.github.com/
# GET TAG NAME
- name: Generate Tag name
run: |
if [ ${{ inputs.dev }} == true ]; then
echo "TAG_NAME=$(npm version prerelease --preid=${{ inputs.jsTag }} --no-git-tag-version --allow-same-version)" >> $GITHUB_ENV
else
echo "TAG_NAME=$(npm version patch)" >> $GITHUB_ENV
fi
# DOWNLOAD CLI IF IT IS A DEV VERSION AND A CLI TAG WAS PROVIDED
- name: Download cli with tag ${{ inputs.cliTag }}
if: inputs.dev == true && inputs.cliTag != ''
run: |
# Update binaries
chmod +x ./.github/scripts/update_cli.sh
./.github/scripts/update_cli.sh ${{ inputs.cliTag }}
# RUN NPM INSTALL AND BUILD
- name: NPM ci and build
run: |
npm ci
npm run build
# # PUSH TAGS IF IT IS A RELEASE
# - name: Push tag if release
# if: inputs.dev == false
# run: |
# git pull
# git push --set-upstream origin ${{ inputs.branch }} && git push --tags
- name: Create Pull Request
id: create_pr
if: inputs.dev == false
uses: peter-evans/[email protected]
with:
token: ${{ secrets.TAMAR_PAT }}
branch: ${{ inputs.branch }}
title: "Automated Changes"
body: "This is an automated PR created by GitHub Actions"
base: main
draft: false
# delete-branch: true
# auto-merge:
# runs-on: ubuntu-latest
# needs: create-pr
# steps:
- name: Wait for PR to be created
id: pr
if: inputs.dev == false
uses: octokit/[email protected]
with:
route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ inputs.branch }}
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge Pull Request
if: inputs.dev == false
uses: octokit/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.TAMAR_PAT }}
with:
route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge
# token: ${{ secrets.TAMAR_PAT }}
merge_method: squash
# # PUBLISH NPM PACKAGE
# - name: Publish npm package
# run: |
# if [ ${{ inputs.dev }} == true ]; then
# npm publish --tag=${{ inputs.jsTag }}
# else
# npm publish --access public
# fi
# env:
# NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# CREATE RELEASE
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.TAG_NAME }}
tag_name: ${{ env.TAG_NAME }}
generate_release_notes: true
prerelease: ${{ inputs.dev }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Ensure this token is used here as well