Skip to content

Commit

Permalink
Updated references to called deploy-1-setup.yml with the new ref, ver…
Browse files Browse the repository at this point in the history
…sion inputs (#46)

* Updated references to called deploy-1-setup.yml with the new ref, version inputs

* cd.yml: Made the deployment ref more generic than just main
  • Loading branch information
CodeGat authored Feb 8, 2024
1 parent c0710ac commit 0f37d7f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- generate-tag
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main
with:
ref: ${{ github.ref_name }}
version: ${{ needs.generate-tag.outputs.name }}
secrets: inherit
permissions:
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,23 @@ jobs:
needs:
- branch-check
outputs:
number: ${{ steps.history.outputs.commits }}
number: ${{ steps.get-version.outputs.number }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Get Number of Commits on ${{ github.head_ref }}
id: history
run: echo "commits=$(git rev-list --count origin/main..HEAD)" >> $GITHUB_OUTPUT
- name: Generate Version Number
id: get-version
# This step generates the version number for prereleases, which given a branch
# like `pre-<version>`, looks like: `<version>-<number of commits on this branch>`.
# Ex. `pre-2024.10.1` with 2 commits on branch -> `2024.10.1-2`.
run: |
number_of_commits=$(git rev-list --count origin/main..HEAD)
no_pre_version=$(cut --delimiter '-' --field 2 <<< "${{ github.head_ref }}")
echo "number=${no_pre_version}-${number_of_commits}" >> $GITHUB_OUTPUT
prerelease-deploy:
name: Deploy to Prerelease
Expand All @@ -170,5 +177,6 @@ jobs:
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main
with:
type: prerelease
version: ${{ github.head_ref }}-${{ needs.prerelease-deploy-version.outputs.number }}
ref: ${{ github.head_ref }}
version: ${{ needs.prerelease-deploy-version.outputs.number }}
secrets: inherit

0 comments on commit 0f37d7f

Please sign in to comment.