Skip to content

Commit 847caea

Browse files
Migrate CI/CD from CircleCI to GitHub Actions with separate build and release jobs (#81)
* chore: migrate from CircleCI to GitHub Actions Agent-Logs-Url: https://github.com/qlik-oss/variance-waterfall/sessions/90ca049c-978c-4fc7-87f2-fdd076707251 Co-authored-by: niekvanstaveren <25658598+niekvanstaveren@users.noreply.github.com> * chore: split workflow into build (PR + master) and release (master only) jobs Agent-Logs-Url: https://github.com/qlik-oss/variance-waterfall/sessions/42e24d44-3961-40ab-a11e-bec265d81707 Co-authored-by: niekvanstaveren <25658598+niekvanstaveren@users.noreply.github.com> * chore: add lint runner --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: niekvanstaveren <25658598+niekvanstaveren@users.noreply.github.com> Co-authored-by: Niek van Staveren <niek.vanstaveren@qlik.com>
1 parent c2a5417 commit 847caea

5 files changed

Lines changed: 88 additions & 108 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
env:
17+
PACKAGE_NAME: "qlik-variance-waterfall"
18+
outputs:
19+
version: ${{ steps.bump-version.outputs.VERSION }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: "16"
26+
27+
- name: Bump version
28+
id: bump-version
29+
run: |
30+
chmod +x scripts/bump-version.sh
31+
chmod +x scripts/get-latest-version.sh
32+
scripts/bump-version.sh ${{ github.repository_owner }} ${{ github.event.repository.name }}
33+
VERSION=$(cat BUMPED_VERSION)
34+
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
35+
36+
- name: Install dependencies
37+
run: npm install
38+
39+
- name: Lint
40+
run: npm run eslint
41+
42+
- name: Build and package
43+
env:
44+
NODE_ENV: production
45+
VERSION: ${{ steps.bump-version.outputs.VERSION }}
46+
run: |
47+
echo "Version: ${VERSION}"
48+
npm run build:zip
49+
chmod +x scripts/verify-files.sh
50+
scripts/verify-files.sh
51+
52+
- name: Upload artifact
53+
if: github.event_name == 'push' && github.ref_name == 'master'
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: dist
57+
path: dist/
58+
59+
release:
60+
needs: build
61+
if: github.event_name == 'push' && github.ref_name == 'master'
62+
runs-on: ubuntu-latest
63+
permissions:
64+
contents: write
65+
env:
66+
PACKAGE_NAME: "qlik-variance-waterfall"
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Download artifact
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: dist
74+
path: dist/
75+
76+
- name: Create GitHub Release
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
VERSION: ${{ needs.build.outputs.version }}
80+
run: |
81+
chmod +x scripts/create-release.sh
82+
scripts/create-release.sh ${{ github.repository_owner }} ${{ github.event.repository.name }} ${PACKAGE_NAME} ${VERSION}

scripts/bump-version.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ join_by () {
55
local IFS="$1"; shift; echo "$*";
66
}
77

8-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
8+
if [ "${GITHUB_REF_NAME}" == "master" ]; then
99
# get version from repo
1010
OLD_VERSION="$(scripts/get-latest-version.sh $1 $2)"
1111
echo "Latest GitHub release version: ${OLD_VERSION}"
@@ -18,8 +18,8 @@ if [ "${CIRCLE_BRANCH}" == "master" ]; then
1818

1919
# join into string
2020
NEW_VERSION=$(join_by . ${ARRAY_VERSION[@]})
21-
elif [[ ! -z "${CIRCLE_BRANCH}" && ! -z "${CIRCLE_BUILD_NUM}" ]]; then
22-
NEW_VERSION="$(echo ${CIRCLE_BRANCH} | sed -e 's/\//-/g')_${CIRCLE_BUILD_NUM}"
21+
elif [[ ! -z "${GITHUB_REF_NAME}" && ! -z "${GITHUB_RUN_NUMBER}" ]]; then
22+
NEW_VERSION="$(echo ${GITHUB_REF_NAME} | sed -e 's/\//-/g')_${GITHUB_RUN_NUMBER}"
2323
else
2424
NEW_VERSION="dev"
2525
fi

scripts/create-release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
set -o errexit
33

4-
echo "Creating release for version: $VERSION"
5-
echo "Artifact name: ./dist/${3}_${VERSION}.zip"
6-
$HOME/bin/ghr -t ${ghoauth} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} "./dist/${3}_${4}.zip"
4+
echo "Creating release for version: $4"
5+
echo "Artifact name: ./dist/${3}_${4}.zip"
6+
gh release create "${4}" "./dist/${3}_${4}.zip" --repo "${1}/${2}"
77

88

99
# Usage

scripts/install-ghr.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)