Skip to content

Commit f369127

Browse files
committed
Release 0.2.0, generated from commit eb17149
1 parent 695b5b8 commit f369127

File tree

17 files changed

+15817
-55
lines changed

17 files changed

+15817
-55
lines changed

.github/workflows/generate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ jobs:
8181
cp LICENSE release/
8282
cp .gitignore release/
8383
84+
# Copy release dockerfile as main dockerfile
85+
cp Dockerfile.release release/Dockerfile
86+
8487
# Add all gitignore except dist folder
8588
head -n -4 .gitignore > release/.gitignore
8689

.github/workflows/release.yml

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'releases/*'
77

88
jobs:
9-
release:
9+
docker:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
@@ -32,7 +32,90 @@ jobs:
3232
echo "create_release=yes" >> $GITHUB_ENV
3333
fi
3434
35-
- name: Release
35+
- name: Docker meta
36+
if: ${{ env.create_release == 'yes' }}
37+
id: meta
38+
uses: docker/metadata-action@v3
39+
with:
40+
# list of Docker images to use as base name for tags
41+
images: |
42+
boringdownload/jira-integration
43+
ghcr.io/rohit-gohri/jira-ci-cd-integration
44+
registry.gitlab.com/rohit-gohri/jira-ci-cd-integration
45+
# generate Docker tags based on the following events/attributes
46+
tags: |
47+
type=ref,event=branch
48+
ype=semver,pattern={{version}},value=v${{ env.package_version }}
49+
ype=semver,pattern=v{{major}},value=v${{ env.package_version }}
50+
type=sha
51+
52+
- name: Set up QEMU
53+
if: ${{ env.create_release == 'yes' }}
54+
uses: docker/setup-qemu-action@v1
55+
- name: Set up Docker Buildx
56+
if: ${{ env.create_release == 'yes' }}
57+
uses: docker/setup-buildx-action@v1
58+
59+
- name: 🛂 Log in to Docker Hub
60+
if: ${{ env.create_release == 'yes' }}
61+
uses: docker/login-action@v1
62+
with:
63+
username: ${{ secrets.DOCKER_USERNAME }}
64+
password: ${{ secrets.DOCKER_TOKEN }}
65+
66+
- name: 🛂 Log in to the Github Container registry
67+
if: ${{ env.create_release == 'yes' }}
68+
uses: docker/login-action@v1
69+
with:
70+
registry: ghcr.io
71+
username: ${{ github.repository_owner }}
72+
password: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: 🛂 Log in to the Gitlab Container registry
75+
if: ${{ env.create_release == 'yes' }}
76+
uses: docker/login-action@v1
77+
with:
78+
registry: registry.gitlab.com
79+
username: ${{ secrets.GITLAB_USERNAME }}
80+
password: ${{ secrets.GITLAB_TOKEN }}
81+
82+
- name: 🔨🚀 Build and push
83+
if: ${{ env.create_release == 'yes' }}
84+
uses: docker/build-push-action@v2
85+
with:
86+
context: .
87+
platforms: linux/amd64,linux/arm64
88+
push: true
89+
tags: ${{ steps.meta.outputs.tags }}
90+
labels: ${{ steps.meta.outputs.labels }}
91+
92+
action:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@v2
97+
with:
98+
fetch-depth: 0
99+
100+
- name: Check if tag already exists
101+
run: |
102+
# Get version from package.json (head is needed because this also returns "version" npm script line)
103+
sed -n '/version/s/,*\r*$//p' package.json | cut -d ':' -f2,3 | sed -e 's/^ "//' -e 's/"$//' | head -n 1 > app_version.tmp
104+
cat app_version.tmp | cut -d. -f1 > major_version.tmp
105+
106+
export VERSION_TAG="v$(cat app_version.tmp)"
107+
echo "package_version=$(cat app_version.tmp)" >> $GITHUB_ENV
108+
echo "major_version=$(cat major_version.tmp)" >> $GITHUB_ENV
109+
110+
# Check if tag already exists
111+
if [ $(git tag -l "$VERSION_TAG") ]; then
112+
echo "Tag already exists, please increment version to create release"
113+
echo "create_release=no" >> $GITHUB_ENV
114+
else
115+
echo "create_release=yes" >> $GITHUB_ENV
116+
fi
117+
118+
- name: 🚀 Release
36119
uses: softprops/action-gh-release@master
37120
if: ${{ env.create_release == 'yes' }}
38121
with:
@@ -41,7 +124,7 @@ jobs:
41124
env:
42125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43126

44-
- name: Tag Major Version
127+
- name: 🚀 Tag Major Version
45128
if: ${{ env.create_release == 'yes' }}
46129
run: |
47130
git config user.name github-actions[bot]

.github/workflows/test-release.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'releases/*'
77

88
jobs:
9-
build: # make sure build/ci work properly
9+
build:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Jira Development Integration
@@ -20,3 +20,19 @@ jobs:
2020
token: ${{ secrets.GITHUB_TOKEN }}
2121
client_id: ${{ secrets.JIRA_CLIENT_ID }}
2222
client_secret: ${{ secrets.JIRA_CLIENT_SECRET }}
23+
24+
# TODO: Fix this
25+
# deployment:
26+
# runs-on: ubuntu-latest
27+
# steps:
28+
# - name: Jira Development Integration
29+
# uses: rohit-gohri/jira-ci-cd-integration@v0
30+
# env:
31+
# JIRA_DEFAULT_TEST_ISSUE: 'JCI-7'
32+
# with:
33+
# event_type: deployment
34+
# state: ${{ job.status }}
35+
# jira_instance: boringdownload
36+
# token: ${{ secrets.GITHUB_TOKEN }}
37+
# client_id: ${{ secrets.JIRA_CLIENT_ID }}
38+
# client_secret: ${{ secrets.JIRA_CLIENT_SECRET }}

.github/workflows/test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ jobs:
3434
- name: 📦 Install dependencies
3535
run: npm ci
3636

37-
- name: 🔨 Build Project
38-
run: npm run package
37+
- name: Checks
38+
run: |
39+
npm run lint
40+
npm run build
41+
npm run test
42+
43+
- name: 🔨 Package Action
44+
run: npm run package:action
3945

4046
- name: Test Action
4147
uses: ./

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node:12-alpine
2+
3+
WORKDIR /usr/jira-ci-cd-integration
4+
5+
# Bundle app source
6+
COPY . .
7+
8+
CMD ["node", "dist/docker/index.js"]

README.md

Lines changed: 78 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
<p align="center">
2-
3-
[![Github Release](https://img.shields.io/github/v/release/rohit-gohri/jira-ci-cd-integration?style=flat-square)](https://github.com/rohit-gohri/jira-ci-cd-integration/releases)
4-
5-
<a href="https://github.com/rohit-gohri/jira-ci-cd-integration/actions"><img alt="action status" src="https://github.com/rohit-gohri/jira-ci-cd-integration/workflows/build-test/badge.svg"></a>
1+
[![Github Release](https://img.shields.io/github/v/release/rohit-gohri/jira-ci-cd-integration?style=flat)](https://github.com/rohit-gohri/jira-ci-cd-integration/releases)
2+
[![Docker Release](https://img.shields.io/docker/v/boringdownload/jira-integration)](https://hub.docker.com/repository/docker/boringdownload/jira-integration)
3+
<a href="https://github.com/rohit-gohri/jira-ci-cd-integration/actions"><img alt="action status" src="https://github.com/rohit-gohri/jira-ci-cd-integration/workflows/build-test/badge.svg"></a>
4+
<a href="https://github.com/rohit-gohri/jira-ci-cd-integration/actions"><img alt="action status" src="https://github.com/rohit-gohri/jira-ci-cd-integration/workflows/release/badge.svg"></a>
65

7-
</p>
6+
# Jira Development Integration
87

9-
# Jira CI/CD Integration
8+
Integrate your CI/CD pipeline's Build and Deployment information into the Jira Development Panel.
109

11-
Integrate your CI/CD pipeline information into the Jira Builds/Deployments Panel.
10+
![Builds Panel Preview](./docs/builds-panel.png)
1211

1312
> Only supports Jira Cloud. Does not support Jira Server (hosted)
1413
15-
![Builds Panel Preview](./docs/builds-panel.png)
16-
1714
## Prerequisites
1815

1916
### Generate Credentials
@@ -66,32 +63,93 @@ Generate new OAuth Credentials and copy
6663
client_secret: ${{ secrets.JIRA_CLIENT_SECRET }}
6764
```
6865
69-
#### Options
66+
## Use with Other CI/CD Providers
67+
68+
Supported in providers which support running arbitrary Docker images (like Drone, Gitlab CI).
69+
70+
Docker Images are available from:
71+
72+
- Docker Hub: `boringdownload/jira-integration`
73+
- Github Container Registry: `ghcr.io/rohit-gohri/jira-ci-cd-integration`
74+
- Gitlab Container Registry: `registry.gitlab.com/rohit-gohri/jira-ci-cd-integration`
75+
76+
Pick whatever you want and is convenient for you.
77+
78+
### Set Env Vars
79+
80+
Configuration for the Docker image is through env vars. Read more in [options](#options).
81+
82+
#### Drone.io
83+
84+
Add secrets for `JIRA_CLIENT_ID` and `JIRA_CLIENT_SECRET` and then add this to your pipeline:
85+
86+
```yaml
87+
steps:
88+
- name: jira-integration
89+
image: boringdownload/jira-integration:v0
90+
environment:
91+
BUILD_NAME: drone-pipeline
92+
JIRA_INSTANCE: companyname
93+
JIRA_CLIENT_ID:
94+
from_secret: jira_client_id
95+
JIRA_CLIENT_SECRET:
96+
from_secret: jira_client_secret
97+
```
98+
99+
#### Gitlab CI/CD
100+
101+
[Add a CI/CD Variable to your project](https://docs.gitlab.com/ee/ci/variables/#add-a-cicd-variable-to-a-project) for `JIRA_CLIENT_ID` and `JIRA_CLIENT_SECRET` and then add this step to your pipeline, preferably in the last stage.
102+
103+
```yaml
104+
jira-integration:
105+
image: registry.gitlab.com/rohit-gohri/jira-ci-cd-integration:v0
106+
variables:
107+
BUILD_NAME: gitlab-pipeline
108+
JIRA_INSTANCE: companyname
109+
```
110+
111+
## Options
112+
113+
Provide these options directly in case of Github Actions or via the env variable in the brackets for Docker.
70114

71-
##### jira_instance
115+
### Inputs
72116

73-
Sub Domain of Jira Cloud Instance
117+
#### jira_instance (JIRA_INSTANCE)
74118

75-
##### client_id
119+
Sub Domain of Jira Cloud Instance. This part of the url: `https://<jira_instance>.atlassian.net`
120+
121+
#### client_id (JIRA_CLIENT_ID)
76122

77123
ClientID of OAuth Creds
78124

79-
##### client_secret
125+
#### client_secret (JIRA_CLIENT_SECRET)
80126

81127
Client Secret of OAuth Creds
82128

83-
##### event_type (optional)
129+
#### event_type (JIRA_EVENT_TYPE) (optional)
84130

85131
"build" or "deployment", (default is "build")
86132

87-
##### state (optional)
133+
#### state (BUILD_STATE) (optional)
88134

89-
"successful"/"success", "failed", or "canceled" (default is "successful")
135+
"successful"/"success", "failed", or "canceled" (default is "unknown")
90136

91-
##### issue (optional)
137+
#### issue (JIRA_ISSUES) (optional)
92138

93139
Will be parsed from branch name automatically if absent. Or you can provide it according to your own logic. Can be multiple issues.
94140

95-
##### token (optional)
141+
#### token (optional)
142+
143+
> Only for Github Action
96144

97145
Github Token to get commit message in Pull Request Events. Since github context doesn't have commit message, we use the Github API to get it from sha.
146+
147+
### Pipeline Info
148+
149+
#### Commit Message (COMMIT_MESSAGE)
150+
151+
If you have the jira id in the commit message then provide this.
152+
153+
#### Pipeline Name (BUILD_NAME)
154+
155+
A name for your pipeline

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ inputs:
3030
description: Will be parsed from branch name automatically
3131
runs:
3232
using: 'node12'
33-
main: 'dist/index.js'
33+
main: 'dist/github/index.js'

0 commit comments

Comments
 (0)