Skip to content

Commit

Permalink
ci: fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
genisd committed Oct 31, 2023
1 parent 8619658 commit ea95c44
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/jsonnet/GIT_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9f0090f332fe3306ec145c60d2e129628aee2f9c
afbecf4e8ac7ba526d30b74f71f29f0f287074b1
4 changes: 2 additions & 2 deletions .github/jsonnet/complete-workflows.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
$.pipeline(
'publish-prod',
[
$.yarnPublishJob(repositories, runsOn=runsOn),
$.yarnPublishJob(repositories=repositories, runsOn=runsOn),
],
event={ push: { branches: ['${{ github.event.pull_request.base.ref }}'] } },
event={ push: { branches: ['${{ github.event.pull_request.base.repo.default_branch }}'] } },
) +
$.pipeline(
'pr',
Expand Down
4 changes: 2 additions & 2 deletions .github/jsonnet/deployment.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'auto-merge': 'false',
ref: '${{ github.event.pull_request.head.sha }}',
description: 'Auto deploy production on PR merge. pr: ${{ github.event.number }} ref: ${{ github.event.pull_request.head.sha }}',
payload: '{ "pr" : ${{ github.event.number }}, "branch": "${{ github.head_ref }}" }',
payload: '{ "pr" : ${{ github.event.number }}, "branch": "${{ github.head_ref }}", "base_ref": "${{ github.event.pull_request.base.sha }}", "head_ref": "${{ github.event.pull_request.head.sha }}" }',
}
),
$.sendSlackMessage(
Expand Down Expand Up @@ -74,7 +74,7 @@
'auto-merge': 'false',
ref: '${{ github.event.pull_request.head.sha }}',
description: 'Auto deploy test on PR merge. pr: ${{ github.event.number }} ref: ${{ github.event.pull_request.head.sha }}',
payload: '{ "pr" : ${{ github.event.number }}, "branch": "${{ github.head_ref }}" }',
payload: '{ "pr" : ${{ github.event.number }}, "branch": "${{ github.head_ref }}", "base_ref": "${{ github.event.pull_request.base.sha }}", "head_ref": "${{ github.event.pull_request.head.sha }}" }',
}
),
],
Expand Down
14 changes: 8 additions & 6 deletions .github/jsonnet/misc.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,21 @@
// if: steps.changes.outputs.app == 'true'
//
// See https://github.com/dorny/paths-filter for more information.
testForChangedFiles(changedFiles)::
testForChangedFiles(changedFiles, headRef=null, baseRef=null)::
[
$.step('git safe directory', 'git config --global --add safe.directory $PWD'),
$.action(
'check-for-changes',
uses='dorny/paths-filter@v2',
id='changes',
with={
filters: |||
%s
||| % std.manifestYamlDoc(changedFiles),
token: '${{ github.token }}',
}
filters: |||
%s
||| % std.manifestYamlDoc(changedFiles),
token: '${{ github.token }}',
} +
(if headRef != null then { ref: headRef } else {}) +
(if baseRef != null then { base: baseRef } else {}),
),
],

Expand Down
10 changes: 7 additions & 3 deletions .github/jsonnet/yarn.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]]; then
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]] || [[ "${GITHUB_EVENT_NAME}" == "deployment" ]]; then
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
Expand Down Expand Up @@ -189,6 +189,8 @@
checkVersionBump=true,
repositories=['gynzy'],
onChangedFiles=false,
changedFilesHeadRef=null,
changedFilesBaseRef=null,
runsOn=null,
):
local ifClause = (if onChangedFiles != false then "steps.changes.outputs.package == 'true'" else null);
Expand All @@ -199,7 +201,7 @@
useCredentials=false,
steps=
[$.checkoutAndYarn(ref=gitCloneRef, fullClone=false)] +
(if onChangedFiles != false then $.testForChangedFiles({ package: onChangedFiles }) else []) +
(if onChangedFiles != false then $.testForChangedFiles({ package: onChangedFiles }, headRef=changedFilesHeadRef, baseRef=changedFilesBaseRef) else []) +
(if checkVersionBump then [
$.action('check-version-bump', uses='del-systems/check-if-version-bumped@v1', with={
token: '${{ github.token }}',
Expand All @@ -217,6 +219,8 @@
buildSteps=[$.step('build', 'yarn build')],
repositories=['gynzy'],
onChangedFiles=false,
changedFilesHeadRef=null,
changedFilesBaseRef=null,
ifClause=null,
runsOn=null,
):
Expand All @@ -228,7 +232,7 @@
useCredentials=false,
steps=
[$.checkoutAndYarn(ref=gitCloneRef, fullClone=false)] +
(if onChangedFiles != false then $.testForChangedFiles({ package: onChangedFiles }) else []) +
(if onChangedFiles != false then $.testForChangedFiles({ package: onChangedFiles }, headRef=changedFilesHeadRef, baseRef=changedFilesBaseRef) else []) +
(if onChangedFiles != false then std.map(function(step) std.map(function(s) s { 'if': stepIfClause }, step), buildSteps) else buildSteps) +
$.yarnPublishToRepositories(isPr=false, repositories=repositories, ifClause=stepIfClause),
permissions={ packages: 'write', contents: 'read', 'pull-requests': 'read' },
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]]; then
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]] || [[ "${GITHUB_EVENT_NAME}" == "deployment" ]]; then
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]]; then
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]] || [[ "${GITHUB_EVENT_NAME}" == "deployment" ]]; then
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
Expand All @@ -71,4 +71,4 @@
"on":
"push":
"branches":
- "${{ github.event.pull_request.base.ref }}"
- "${{ github.event.pull_request.base.repo.default_branch }}"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gynzy/ember-redux",
"version": "6.0.3",
"version": "6.0.4",
"description": "ember-cli addon that provides simple redux bindings for ember.js",
"scripts": {
"build": "ember build",
Expand Down

0 comments on commit ea95c44

Please sign in to comment.