Skip to content

Commit

Permalink
Merge pull request #107 from che-incubator/release-fix
Browse files Browse the repository at this point in the history
fix: fix release workflow
  • Loading branch information
mkuznyetsov authored Sep 16, 2022
2 parents d07817b + 8564ca3 commit ce44b0a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ jobs:
# don't notify for cancelled builds
if: (success() || failure()) && github.ref != 'refs/heads/main'
steps:
- name: Set variables
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- name: Create failure MM message
if: failure()
if: contains(join(needs.*.result, ','), 'failure')
run: |
echo "{\"text\":\":no_entry_sign: Che Code ${{ env.BRANCH_NAME }} release has failed: https://github.com/che-incubator/che-code/actions/workflows/release.yml\"}" > mattermost.json
echo "{\"text\":\":no_entry_sign: Che Code ${{ env.BRANCH_NAME }} release has failed: https://github.com/che-incubator/che-code/actions/workflows/image-publish.yml\"}" > mattermost.json
- name: Create success MM message
run: |
echo "{\"text\":\":white_check_mark: Che Code ${{ env.BRANCH_NAME }} has been released: https://quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }}\"}" > mattermost.json
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
-
name: "Checkout Che Code source code"
uses: actions/checkout@v2
with:
token: ${{ secrets.CHE_INCUBATOR_BOT_TOKEN }}
-
name: "Setup Node"
uses: actions/setup-node@v2
Expand Down Expand Up @@ -57,5 +59,17 @@ jobs:
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "mkuznets@redhat.com"
git config --global pull.rebase true
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }}
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_TOKEN }}
/bin/bash make-release.sh --version ${{ github.event.inputs.version }} --tag-release
- name: Create failure MM message
if: failure()
run: |
echo "{\"text\":\":no_entry_sign: Che Code ${{ env.BRANCH_NAME }} release has failed: https://github.com/che-incubator/che-code/actions/workflows/release.yml\"}" > mattermost.json
- name: Send MM message
# only notify for failure, success message will be sent at the end of image-publish job
if: failure()
uses: mattermost/action-mattermost-notify@1.1.0
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: eclipse-che-releases
MATTERMOST_USERNAME: che-bot
12 changes: 8 additions & 4 deletions make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ bump_version () {
BUMP_BRANCH=$2

git checkout "${BUMP_BRANCH}"

if [[ $(grep version package.json | awk -F \" '{print $4}') == ${NEXT_VERSION} ]]; then
echo "Next project version is already present in package.json"
git checkout "${CURRENT_BRANCH}"
return
fi
echo "Updating project version to ${NEXT_VERSION}"
npm --no-git-tag-version version --allow-same-version $NEXT_VERSION
npm --no-git-tag-version version --allow-same-version ${NEXT_VERSION}

if [[ ${NOCOMMIT} -eq 0 ]]; then
COMMIT_MSG="chore: Bump to ${NEXT_VERSION} in ${BUMP_BRANCH}"
git commit -asm "${COMMIT_MSG}"
git commit -asm "${COMMIT_MSG}" || true
git pull origin "${BUMP_BRANCH}"

set +e
Expand Down Expand Up @@ -105,7 +109,7 @@ fi

set -e

npm --no-git-tag-version version --allow-same-version "${VER}"
npm --no-git-tag-version version --allow-same-version "${VERSION}"

# commit change into branch
if [[ ${NOCOMMIT} -eq 0 ]]; then
Expand Down

0 comments on commit ce44b0a

Please sign in to comment.