Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tagging workflow and contributing guide #17

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/update-action-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Update Tag

on:
workflow_dispatch:

permissions:
contents: write

jobs:
update-tag:
name: Update Tag
runs-on: ubuntu-latest
environment: release

steps:
- uses: actions/create-github-app-token@v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this action necessitate the id-token: write permission?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}

- name: Setup
uses: mongodb-labs/drivers-github-tools/setup@v2
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}

- name: Remove the existing tag
run: |
export VERSION=$(cat .github/workflows/version.txt)
echo "VERSION=$VERSION" >> $GITHUB_ENV
git push origin ":${VERSION}"

- name: Create a new signed tag
uses: mongodb-labs/drivers-github-tools/git-sign@v2
with:
command: git tag -m "Update tag" -s --local-user=${{ env.GPG_KEY_ID }} ${{ env.VERSION }}"

- name: Push the tag
run:
git push origin --tags
1 change: 1 addition & 0 deletions .github/workflows/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing to this repository

This repository provides shared GitHub Actions for MongoDB drivers.

Opinionated actions for each driver should go in their own folder.

## Linting

This repo uses [pre-commit](https://pypi.org/project/pre-commit/) for managing linting. `pre-commit` performs various
checks on the files and uses tools that help follow a consistent style within the repo.

To set up `pre-commit` locally, run:

```bash
brew install pre-commit
pre-commit install
```

To run `pre-commit` manually, run `pre-commit run --all-files`.

To run a manual hook like `shellcheck` manually, run:

```bash
pre-commit run --all-files --hook-stage manual shellcheck
```

## Version Tag

To bump the version tag, run the "Update Tag" [workflow](https://github.com/mongodb-labs/drivers-github-tools/actions/workflows/update-action-tag.yml).

To change the major version, update `.github/workflows/version.txt` and all references to `mongodb-labs/drivers-github-tools`
in the repo.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ Use this action to create signed git artifacts:
- name: Create signed commit
uses: mongodb-labs/drivers-github-tools/git-sign@v2
with:
command: "git commit -m 'Commit' -s --gpg-sign=${{ vars.GPG_KEY_ID }}"
command: "git commit -m 'Commit' -s --gpg-sign=${{ env.GPG_KEY_ID }}"

- name: Create signed tag
uses: mongodb-labs/drivers-github-tools/git-sign@v2
with:
command: "git tag -m 'Tag' -s --local-user=${{ vars.GPG_KEY_ID }} <tag>"
command: "git tag -m 'Tag' -s --local-user=${{ env.GPG_KEY_ID }} <tag>"
```

### gpg-sign
Expand Down Expand Up @@ -156,4 +156,4 @@ If `dry_run` is set, nothing will be published or pushed.
product_name: winkerberos
token: ${{ github.token }}
dry_run: ${{ inputs.dry_run }}
```
```
Loading