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

Chore: remove drone and move to github action to release a docker image #255

Merged
merged 9 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
62 changes: 0 additions & 62 deletions .drone.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/do-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bump Version
name: Bump Version and release

on:
workflow_dispatch:
Expand Down
45 changes: 37 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create release and publish
name: Create release and publish to github, npm and docker hub

on:
push:
Expand All @@ -9,7 +9,7 @@ permissions:
contents: write

jobs:
goreleaser:
release-to-github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -20,19 +20,25 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.

- name: Generate token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PEM }}

- uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member Author

@academo academo Sep 17, 2024

Choose a reason for hiding this comment

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

moving away from this token which is most likely expired.

releaseToNpm:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

release-to-npm:
runs-on: ubuntu-latest
needs: goreleaser
needs: release-to-github
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -43,3 +49,26 @@ jobs:
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release-to-dockerhub:
runs-on: ubuntu-latest
# this job doesn't really need the github release, but it is a fast
# way to prevent it from running if the release is bad
needs: release-to-github
steps:
- uses: actions/checkout@v4
- name: Get version from package.json
id: get_version
run: |
echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"

- id: push-to-dockerhub
uses: grafana/shared-workflows/actions/build-push-to-dockerhub@main
with:
repository: grafana/plugin-validator-cli
context: .
tags: |-
"v${{ steps.get_version.outputs.version }}"
"latest"
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
19 changes: 9 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Build and Test
name: Build and Test on pull request

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
test-docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and test Docker container
uses: docker/build-push-action@v6
- id: push-to-dockerhub
Copy link
Member Author

Choose a reason for hiding this comment

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

for consistency I am using the same action here with push: false for testing.

uses: grafana/shared-workflows/actions/build-push-to-dockerhub@main
with:
repository: grafana/plugin-validator-cli
context: .
tags: |-
"test-pr"
push: false
cache-from: type=gha
cache-to: type=gha,mode=max