Skip to content

Commit c8c3b7a

Browse files
authored
Add tagging workflow and contributing guide (#17)
1 parent 5758922 commit c8c3b7a

File tree

4 files changed

+83
-3
lines changed

4 files changed

+83
-3
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Update Tag
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
id-token: write
9+
10+
jobs:
11+
update-tag:
12+
name: Update Tag
13+
runs-on: ubuntu-latest
14+
environment: release
15+
16+
steps:
17+
- uses: actions/create-github-app-token@v1
18+
id: app-token
19+
with:
20+
app-id: ${{ vars.APP_ID }}
21+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
22+
23+
- uses: actions/checkout@v4
24+
with:
25+
token: ${{ steps.app-token.outputs.token }}
26+
27+
- name: Setup
28+
uses: mongodb-labs/drivers-github-tools/setup@v2
29+
with:
30+
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
31+
aws_region_name: ${{ vars.AWS_REGION_NAME }}
32+
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
33+
34+
- name: Remove the existing tag
35+
run: |
36+
export VERSION=$(cat .github/workflows/version.txt)
37+
echo "VERSION=$VERSION" >> $GITHUB_ENV
38+
git push origin ":${VERSION}"
39+
40+
- name: Create a new signed tag
41+
uses: mongodb-labs/drivers-github-tools/git-sign@v2
42+
with:
43+
command: git tag -m "Update tag" -s --local-user=${{ env.GPG_KEY_ID }} ${{ env.VERSION }}"
44+
45+
- name: Push the tag
46+
run:
47+
git push origin --tags

.github/workflows/version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributing to this repository
2+
3+
This repository provides shared GitHub Actions for MongoDB drivers.
4+
5+
Opinionated actions for each driver should go in their own folder.
6+
7+
## Linting
8+
9+
This repo uses [pre-commit](https://pypi.org/project/pre-commit/) for managing linting. `pre-commit` performs various
10+
checks on the files and uses tools that help follow a consistent style within the repo.
11+
12+
To set up `pre-commit` locally, run:
13+
14+
```bash
15+
brew install pre-commit
16+
pre-commit install
17+
```
18+
19+
To run `pre-commit` manually, run `pre-commit run --all-files`.
20+
21+
To run a manual hook like `shellcheck` manually, run:
22+
23+
```bash
24+
pre-commit run --all-files --hook-stage manual shellcheck
25+
```
26+
27+
## Version Tag
28+
29+
To bump the version tag, run the "Update Tag" [workflow](https://github.com/mongodb-labs/drivers-github-tools/actions/workflows/update-action-tag.yml).
30+
31+
To change the major version, update `.github/workflows/version.txt` and all references to `mongodb-labs/drivers-github-tools`
32+
in the repo.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ Use this action to create signed git artifacts:
4545
- name: Create signed commit
4646
uses: mongodb-labs/drivers-github-tools/git-sign@v2
4747
with:
48-
command: "git commit -m 'Commit' -s --gpg-sign=${{ vars.GPG_KEY_ID }}"
48+
command: "git commit -m 'Commit' -s --gpg-sign=${{ env.GPG_KEY_ID }}"
4949
5050
- name: Create signed tag
5151
uses: mongodb-labs/drivers-github-tools/git-sign@v2
5252
with:
53-
command: "git tag -m 'Tag' -s --local-user=${{ vars.GPG_KEY_ID }} <tag>"
53+
command: "git tag -m 'Tag' -s --local-user=${{ env.GPG_KEY_ID }} <tag>"
5454
```
5555

5656
### gpg-sign
@@ -156,4 +156,4 @@ If `dry_run` is set, nothing will be published or pushed.
156156
product_name: winkerberos
157157
token: ${{ github.token }}
158158
dry_run: ${{ inputs.dry_run }}
159-
```
159+
```

0 commit comments

Comments
 (0)