diff --git a/.github/workflows/ci-repo.yml b/.github/workflows/ci-repo.yml index d19ced2..8dc3d5e 100644 --- a/.github/workflows/ci-repo.yml +++ b/.github/workflows/ci-repo.yml @@ -11,8 +11,20 @@ on: - "main" - "release-*" workflow_dispatch: + inputs: + shouldRelease: + description: 'Should a release be created?' + required: false + default: 'false' workflow_call: + inputs: + shouldRelease: + type: boolean + description: 'Should a release be created?' + required: false + default: false + concurrency: group: ci-repo-${{ github.event_name }}-${{ github.ref }} @@ -154,23 +166,33 @@ jobs: name: Release runs-on: ubuntu-latest needs: package - if: github.ref == 'refs/heads/main' + if: + github.ref == 'refs/heads/main' && + (github.event.inputs.shouldRelease == 'true' || github.event.inputs.shouldRelease == true) steps: - name: Checkout code uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: "vscode/.nvmrc" - name: Download VSIX artifacts uses: actions/download-artifact@v3 with: path: ./artifacts - - name: Generate tag name + - name: Read version from package.json + id: get_version + run: echo "version=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT + + - name: Generate tag name with timestamp id: vars shell: bash run: | - SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-8) - TAG_NAME="v0.0.1-dev-${SHORT_SHA}" + TAG_NAME="v${{ steps.get_version.outputs.version }}-dev+$(date +%Y%m%d)" echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - name: Create Pre-release diff --git a/.github/workflows/nightly-ci-repo.yaml b/.github/workflows/nightly-ci-repo.yaml index 2c1ef23..929b0dd 100644 --- a/.github/workflows/nightly-ci-repo.yaml +++ b/.github/workflows/nightly-ci-repo.yaml @@ -9,3 +9,5 @@ on: jobs: nightly: uses: ./.github/workflows/ci-repo.yml + with: + shouldRelease: true \ No newline at end of file