Skip to content

Commit 0a497b0

Browse files
authored
updated dependencies to latest (#63)
- Updated test file to follow the latest pattern - Updated github actions to use the latest version - Updated dependencies to latest version - Implemented eng-automation/js-style deployed library - Before we were using the git hash - Updated version to 0.3.2 - Updated publish script - It's the same as in [auto-merge-bot](https://github.com/paritytech/auto-merge-bot/blob/main/.github/workflows/release.yml)
1 parent 3cc7f36 commit 0a497b0

18 files changed

+2059
-1096
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
.git

.eslintrc.cjs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
const { getConfiguration } = require("opstooling-js-style/src/eslint/configuration");
2-
3-
const tsConfParams = { rootDir: __dirname };
4-
5-
const conf = getConfiguration({ typescript: tsConfParams });
6-
7-
module.exports = conf;
1+
const {
2+
getConfiguration,
3+
getTypescriptOverride,
4+
} = require("@eng-automation/js-style/src/eslint/configuration");
5+
6+
const tsConfParams = { rootDir: __dirname };
7+
8+
const conf = getConfiguration({ typescript: tsConfParams });
9+
10+
const tsConfOverride = getTypescriptOverride(tsConfParams);
11+
conf.overrides.push({
12+
...tsConfOverride,
13+
rules: { "@typescript-eslint/strict-boolean-expressions": 0 },
14+
});
15+
16+
module.exports = conf;

.github/workflows/github-issue-sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- name: Generate token
2020
id: generate_token
21-
uses: tibdex/github-app-token@v1
21+
uses: tibdex/github-app-token@v2.1.0
2222
with:
2323
app_id: ${{ secrets.PROJECT_APP_ID }}
2424
private_key: ${{ secrets.PROJECT_APP_KEY }}
Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
name: Continuous testing
22

3-
on: [pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["master"]
47

58
jobs:
69
test:
10+
strategy:
11+
matrix:
12+
command: [lint, build, test]
713
runs-on: ubuntu-latest
14+
name: running ${{ matrix.command }}
815
steps:
9-
- uses: actions/checkout@v3
10-
- name: Use node 18
11-
uses: actions/setup-node@v3
16+
- uses: actions/checkout@v4.1.1
17+
- uses: actions/setup-node@v4.0.2
1218
with:
13-
node-version: 18
19+
node-version: 20
20+
- name: Cache node modules
21+
id: cache-npm
22+
uses: actions/cache@v4
23+
env:
24+
cache-name: cache-node-modules
25+
with:
26+
# npm cache files are stored in `~/.npm` on Linux/macOS
27+
path: ~/.npm
28+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
29+
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-
1430
- name: Install dependencies
1531
run: yarn install --frozen-lockfile
16-
- name: Run tests
17-
run: yarn test
18-
- name: Run lint
19-
run: yarn lint
20-
- name: Build the project
21-
run: yarn build
32+
- run: yarn run ${{ matrix.command }}
33+
34+
conclude:
35+
runs-on: ubuntu-latest
36+
name: All tests passed
37+
needs: [test]
38+
steps:
39+
- run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY

.github/workflows/publish.yml

Lines changed: 45 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -7,109 +7,70 @@ on:
77

88
env:
99
IMAGE_NAME: action
10+
REGISTRY: ghcr.io
1011

1112
jobs:
1213
test-image:
1314
runs-on: ubuntu-latest
1415
steps:
15-
- uses: actions/checkout@v3.3.0
16+
- uses: actions/checkout@v4.1.1
1617
- name: Check that the image builds
1718
run: docker build . --file Dockerfile
1819

19-
test-versions:
20+
compare-versions:
2021
runs-on: ubuntu-latest
22+
outputs:
23+
version: ${{ steps.verification.outputs.VERSION }}
24+
exists: ${{ steps.checkTag.outputs.exists }}
2125
steps:
22-
- uses: actions/checkout@v3.3.0
26+
- uses: actions/checkout@v4.1.1
2327
- name: Extract package.json version
2428
id: package_version
2529
run: echo "VERSION=$(jq '.version' -r package.json)" >> $GITHUB_OUTPUT
26-
- name: Extract action.yml version
27-
uses: mikefarah/yq@master
28-
id: action_image
29-
with:
30-
cmd: yq '.runs.image' 'action.yml'
31-
- name: Parse action.yml version
32-
id: action_version
33-
run: |
34-
echo "IMAGE_VERSION=$(echo $IMAGE_URL | cut -d: -f3)" >> $GITHUB_OUTPUT
35-
env:
36-
IMAGE_URL: ${{ steps.action_image.outputs.result }}
30+
# Compare that the versions contain the same name
3731
- name: Compare versions
38-
run: |
39-
echo "Verifying that $IMAGE_VERSION from action.yml is the same as $PACKAGE_VERSION from package.json"
40-
[[ $IMAGE_VERSION == $PACKAGE_VERSION ]]
41-
env:
42-
IMAGE_VERSION: ${{ steps.action_version.outputs.IMAGE_VERSION }}
43-
PACKAGE_VERSION: ${{ steps.package_version.outputs.VERSION }}
44-
45-
tag:
46-
if: github.event_name == 'push'
47-
needs: [test-image, test-versions]
48-
runs-on: ubuntu-latest
49-
permissions:
50-
contents: write
51-
outputs:
52-
tagcreated: ${{ steps.autotag.outputs.tagcreated }}
53-
tagname: ${{ steps.autotag.outputs.tagname }}
54-
steps:
55-
- uses: actions/checkout@v3.3.0
56-
with:
57-
fetch-depth: 0
58-
- uses: butlerlogic/action-autotag@stable
59-
id: autotag
32+
id: verification
33+
uses: Bullrich/compare-version-on-action@main
6034
with:
61-
head_branch: master
62-
tag_prefix: "v"
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
- name: Changelog
66-
uses: Bullrich/generate-release-changelog@2.0.2
67-
id: Changelog
68-
env:
69-
REPO: ${{ github.repository }}
70-
- name: Create Release
71-
if: steps.autotag.outputs.tagname != ''
72-
uses: actions/create-release@latest
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
with:
76-
tag_name: ${{ steps.autotag.outputs.tagname }}
77-
release_name: Release ${{ steps.autotag.outputs.tagname }}
78-
body: |
79-
${{ steps.Changelog.outputs.changelog }}
35+
version: ${{ steps.package_version.outputs.VERSION }}
36+
# Verifies if there is a tag with that version number
37+
- uses: mukunku/tag-exists-action@v1.4.0
38+
if: steps.verification.outputs.VERSION
39+
id: checkTag
40+
with:
41+
tag: v${{ steps.package_version.outputs.VERSION }}
8042

8143
publish:
44+
if: github.event_name == 'push' && needs.compare-versions.outputs.exists == 'false'
45+
needs: [test-image, compare-versions]
8246
runs-on: ubuntu-latest
8347
permissions:
48+
contents: write
8449
packages: write
85-
needs: [tag]
86-
if: needs.tag.outputs.tagname != ''
8750
steps:
88-
- uses: actions/checkout@v3
89-
- name: Build image
90-
run: docker build . --file Dockerfile --tag $IMAGE_NAME
91-
- name: Log into registry
92-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
93-
- name: Push image
94-
run: |
95-
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
96-
97-
# Change all uppercase to lowercase
98-
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
99-
100-
# Strip git ref prefix from version
101-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
102-
103-
# Strip "v" prefix from tag name
104-
[[ ! -z $TAG ]] && VERSION=$(echo $TAG | sed -e 's/^v//')
105-
106-
# Use Docker `latest` tag convention
107-
[ "$VERSION" == "main" ] && VERSION=latest
108-
109-
echo IMAGE_ID=$IMAGE_ID
110-
echo VERSION=$VERSION
111-
112-
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
113-
docker push $IMAGE_ID:$VERSION
51+
- uses: actions/checkout@v4.1.1
52+
- name: Tag version and create release
53+
run: gh release create $VERSION --generate-notes
11454
env:
115-
TAG: ${{ needs.tag.outputs.tagname }}
55+
VERSION: v${{ needs.compare-versions.outputs.version }}
56+
GH_TOKEN: ${{ github.token }}
57+
- name: Log in to the Container registry
58+
uses: docker/login-action@v3
59+
with:
60+
registry: ${{ env.REGISTRY }}
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
- name: Extract metadata (tags, labels) for Docker
64+
id: meta
65+
uses: docker/metadata-action@v5
66+
with:
67+
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
68+
tags: ${{ needs.compare-versions.outputs.version }}
69+
- uses: actions/checkout@v3
70+
- name: Build and push Docker image
71+
uses: docker/build-push-action@v5
72+
with:
73+
context: .
74+
push: true
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}

.prettierignore

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

.prettierrc.cjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Because this project is intended to be used with a token we need to do an extra
114114
steps:
115115
- name: Generate token
116116
id: generate_token
117-
uses: tibdex/github-app-token@v1
117+
uses: tibdex/github-app-token@v2.1.0
118118
with:
119119
app_id: ${{ secrets.APP_ID }}
120120
private_key: ${{ secrets.PRIVATE_KEY }}

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ inputs:
2929
type: string
3030
runs:
3131
using: 'docker'
32-
image: 'docker://ghcr.io/paritytech/github-issue-sync/action:0.3.1'
32+
image: 'docker://ghcr.io/paritytech/github-issue-sync/action:0.3.2'

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-issue-sync",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "Synchronize issues to GitHub Project boards",
55
"author": "Parity <admin@parity.io> (https://parity.io)",
66
"repository": {
@@ -22,18 +22,18 @@
2222
"lint": "yarn eslint && yarn prettier"
2323
},
2424
"dependencies": {
25-
"@actions/core": "^1.10.0",
26-
"@actions/github": "^5.1.1",
27-
"@octokit/rest": "^19.0.5"
25+
"@actions/core": "^1.10.1",
26+
"@actions/github": "^6.0.0",
27+
"@octokit/rest": "^20.0.2"
2828
},
2929
"devDependencies": {
30-
"@octokit/graphql-schema": "^12.41.1",
31-
"@types/jest": "^29.2.6",
32-
"@vercel/ncc": "^0.36.1",
33-
"jest": "^29.3.1",
34-
"jest-mock-extended": "^3.0.1",
35-
"opstooling-js-style": "https://github.com/paritytech/opstooling-js-style#c298d0f732d93712e4397fd53baa3317a3022c8c",
36-
"ts-jest": "^29.0.5",
37-
"typescript": "^4.9.4"
30+
"@eng-automation/js-style": "^2.3.0",
31+
"@octokit/graphql-schema": "^14.58.0",
32+
"@types/jest": "^29.5.12",
33+
"@vercel/ncc": "^0.38.1",
34+
"jest": "^29.7.0",
35+
"jest-mock-extended": "^3.0.5",
36+
"ts-jest": "^29.1.2",
37+
"typescript": "^5.4.2"
3838
}
3939
}

0 commit comments

Comments
 (0)