Skip to content

Commit 65f96eb

Browse files
Merge branch 'main' into chore/update-codeowners-pnpm-uv
2 parents 52ba508 + 9ab4c52 commit 65f96eb

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// @ts-check
2+
3+
/** @param {import('@actions/github-script').AsyncFunctionArguments} args */
4+
export default async function updateMajorTag({ github, context }) {
5+
const tag = context.payload.release?.tag_name;
6+
if (!tag) {
7+
throw new Error("No release tag found in event payload");
8+
}
9+
10+
const match = tag.match(/^(v\d+)\.\d+\.\d+/);
11+
if (!match) {
12+
throw new Error(`Tag "${tag}" does not match semver pattern vX.Y.Z`);
13+
}
14+
15+
const majorTag = match[1];
16+
const sha = context.sha;
17+
18+
const tagsToUpdate = [majorTag, "latest"];
19+
20+
for (const tagName of tagsToUpdate) {
21+
const ref = `tags/${tagName}`;
22+
try {
23+
await github.rest.git.updateRef({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
ref,
27+
sha,
28+
force: true,
29+
});
30+
console.log(`Updated ${ref} to ${sha}`);
31+
} catch (error) {
32+
if (error?.status === 404 || error?.status === 422) {
33+
await github.rest.git.createRef({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
ref: `refs/${ref}`,
37+
sha,
38+
});
39+
console.log(`Created ${ref} at ${sha}`);
40+
} else {
41+
throw error;
42+
}
43+
}
44+
}
45+
}

.github/workflows/versioning.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
actions-tagger:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: Actions-R-Us/actions-tagger@148653c6179832f8392d083de6b46ad3dcc54de3
14+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
15+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
1516
with:
16-
publish_latest_tag: true
17-
token: ${{ secrets.GITHUB_TOKEN }}
17+
script: |
18+
const { default: updateMajorTag } = await import('${{ github.workspace }}/.github/scripts/update-major-tag.js');
19+
await updateMajorTag({ github, context });

example_configs/spec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kind: source
22
spec:
33
name: 'aws'
44
path: 'cloudquery/aws'
5-
version: 'v33.17.0' # latest version of aws plugin
5+
version: 'v33.18.0' # latest version of aws plugin
66
destinations: ['postgresql']
77
tables: ['aws_s3_buckets', 'aws_ec2_instances']
88
---

0 commit comments

Comments
 (0)