-
-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: workflows call workflows #7089
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,13 @@ on: | |
- main | ||
paths-ignore: | ||
- website/** | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
ignore-push: | ||
description: 'Ignore push to dockerhub. If not set the image will be pushed with the sha of the commit as tag' | ||
required: false | ||
type: boolean | ||
Comment on lines
-13
to
-16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the ability of ignoring pushes. We never use it, it was mainly for testing this workflow during development |
||
version: | ||
description: "Which version to release" | ||
type: 'string' | ||
required: true | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
|
@@ -35,10 +34,10 @@ jobs: | |
images: | | ||
unleashorg/unleash-server | ||
tags: | | ||
# only enabled for v* tags: | ||
type=semver,pattern={{ version }},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
type=semver,pattern={{ major.minor }},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
type=semver,pattern={{ major }},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
# only enabled for workflow dispatch except main (assume its a release): | ||
type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }} | ||
type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }} | ||
type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }} | ||
Comment on lines
+37
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we explicitly send the value as in https://github.com/ivarconr/unleash-enterprise/pull/1316 (because we're not using the tag to trigger) |
||
# only enabled in main: | ||
type=edge,prefix=main-,suffix=-${{ matrix.version }},enable=${{ github.ref == 'refs/heads/main' }} | ||
# only enabled on workflow_dispatch: | ||
|
@@ -57,7 +56,7 @@ jobs: | |
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.ignore-push != 'true' }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: NODE_VERSION=${{ matrix.version }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,14 +54,18 @@ jobs: | |
echo PREV=$(git describe --tags ${PREV_COMMIT}) >> $GITHUB_ENV | ||
- if: ${{ !endsWith(github.event.inputs.version, '0') }} | ||
run: echo PREV=$(git describe --abbrev=0) >> $GITHUB_ENV | ||
- name: Generate changelog if not pre-release | ||
- name: Generate changelog from ${{ env.PREV }} | ||
continue-on-error: true | ||
if: ${{ !contains(github.event.inputs.version, '-') }} | ||
env: | ||
PREV: ${{ env.PREV }} | ||
run: | | ||
git-cliff ${PREV}..HEAD --tag v${{ github.event.inputs.version }} --prepend CHANGELOG.md | ||
git-cliff ${{ env.PREV }}..HEAD --tag v${{ github.event.inputs.version }} --prepend CHANGELOG.md | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git commit -am "docs: Update CHANGELOG.md" | ||
else | ||
echo "No changes to CHANGELOG.md" | ||
fi | ||
- run: yarn install --frozen-lockfile --ignore-scripts | ||
- name: npm version | ||
run: | | ||
|
@@ -106,19 +110,27 @@ jobs: | |
git commit -m "chore: bump version to ${{ github.event.inputs.version }}+main" | ||
git push origin main | ||
|
||
update-version-checker: | ||
publish-docker: | ||
needs: build | ||
uses: ./.github/workflows/docker_publish.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
|
||
publish-npm: | ||
needs: build | ||
uses: ./.github/workflows/release.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
|
||
release-changelog: # TODO this changelog is different than the git-cliff one above | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: I'd like to tackle this later but I want to highlight this for the reviewer |
||
needs: build | ||
uses: ./.github/workflows/release_changelog.yml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
|
||
update-version-checker: | ||
needs: publish-docker | ||
if: ${{ github.event.inputs.update-version-function == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Authenticate Google IAM | ||
uses: 'google-github-actions/auth@v2' | ||
with: | ||
workload_identity_provider: 'projects/340004706233/locations/global/workloadIdentityPools/gh-actions-pool/providers/github-actions-oidc-unleash' | ||
service_account: 'versionUpdateSa@metrics-304612.iam.gserviceaccount.com' | ||
token_format: 'access_token' | ||
- name: Update version checker | ||
uses: 'Unleash/update-version-action@v0' | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
distribution: 'oss' | ||
uses: ./.github/workflows/update_version_for_version_checker.yml | ||
with: | ||
version: ${{ github.event.inputs.version }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
name: 'Publish to npm' | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_call: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Publishing to npm based on a workflow call. If we want to still publish on tag we can add workflow_dispatch to call this manually |
||
inputs: | ||
version: | ||
description: "Which version number should we use for the release" | ||
type: 'string' | ||
required: true | ||
|
||
jobs: | ||
build: | ||
|
@@ -35,9 +38,6 @@ jobs: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
Comment on lines
-38
to
-40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't get the version from the tag, but we can receive it as an input parameter |
||
- name: Publish static assets to S3 | ||
run: | | ||
aws s3 cp frontend/build s3://getunleash-static/unleash/${{ steps.get_version.outputs.VERSION }} --recursive | ||
aws s3 cp frontend/build s3://getunleash-static/unleash/v${{ inputs.version }} --recursive | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to prepend Compared in this test https://github.com/gastonfournier/unleash/actions/runs/9161953548/job/25187925675#step:8:8 against an actual release from unleash: https://github.com/Unleash/unleash/actions/runs/9110390951/job/25045331871#step:8:1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
name: 'Releases' | ||
name: 'Release changelog' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a rename. Keeping this workflow relying on tags because it uses a deprecated action and relies on tag refs. We should migrate this: https://github.com/Unleash/unleash/actions/runs/9125610662/job/25092161594#step:4:3 |
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: "Which version number should we use for the release" | ||
type: 'string' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
|
@@ -16,12 +18,13 @@ jobs: | |
uses: metcalfc/changelog-generator@v4.3.1 | ||
with: | ||
myToken: ${{ secrets.GITHUB_TOKEN }} | ||
base-ref: v${{ inputs.version }} | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
uses: softprops/action-gh-release@v2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upgrading to the same action we're using in enterprise as the one at the left is archived |
||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
tag_name: v${{ inputs.version }} | ||
name: v${{ inputs.version }} | ||
body: ${{ steps.github_release.outputs.changelog }} | ||
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} | ||
prerelease: ${{ contains(inputs.version, 'beta') || contains(inputs.version, 'alpha') }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of relying on tags, publish docker from the release workflow: https://github.com/Unleash/unleash/pull/7089/files#diff-c15c3b26808da8f11c4b99dba3911b9ded250104a2c8991073e1993e90444612R111