Skip to content

Commit

Permalink
Add github workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Vernin <olivier.vernin@suse.com>
  • Loading branch information
olblak committed May 26, 2023
1 parent 4d217bd commit d1dc337
Show file tree
Hide file tree
Showing 9 changed files with 348 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
63 changes: 63 additions & 0 deletions .github/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
- 'cleanup'
- 'deprecated'
- 'depreciation'
- title: '📝 Documentation'
labels:
- 'documentation'
- 'doc'
- 'docs'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'

template: |
## Changes
$CHANGES
## Contributors
$CONTRIBUTORS
version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
- 'feature'
- 'enhancement'
patch:
labels:
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
- 'chore'
- 'dependencies'
- 'documentation'
- 'doc'
- 'docs'
- 'cleanup'
- 'deprecated'
- 'depreciation'
default: patch
exclude-labels:
- 'skip-changelog'
15 changes: 15 additions & 0 deletions .github/workflows/add_issue_to_project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Add issues to Updatecli project
on:
issues:
types:
- opened

jobs:
add-to-project:
name: Add issue to Updatecli project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.4.0
with:
project-url: https://github.com/orgs/updatecli/projects/2
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "CodeQL"

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '0 5 * * 0'

jobs:
analyse:
name: Analyse
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
with:
languages: go
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
46 changes: 46 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Go
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run full test once a day
- cron: '0 0 * * *'
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
# https://github.com/actions/setup-go
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.4
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required
# and must be specified without patch version:
# we always use the latest patch version.
version: v1.50
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
install-only: true
- name: Show GoReleaser version
run: goreleaser --version
- name: Build
run: make build
# Codecov should only be updated if make test is executed
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# if: ${{ github.event_name == 'schedule' }}
# Manage and run your integration tests with efficiency
# https://github.com/ovh/venom
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Drafter

on:
workflow_dispatch:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main

jobs:
update_release_draft:
runs-on: ubuntu-20.04
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/release-sandbox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This action is used to validate the release process
# by building assets before a release.
name: Build Release Assets
on:
workflow_dispatch:
push:
branches:
- 'main'
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# https://github.com/actions/setup-go
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.4
id: go
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
install-only: true
- name: Show GoReleaser version
run: goreleaser --version
- name: GoReleaser
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
run: |
make release.snapshot
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Release Assets
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-20.04
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# https://github.com/actions/setup-go
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.4
id: go
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
install-only: true
- name: Show GoReleaser version
run: goreleaser --version
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: tibdex/github-app-token@v1.7
id: generate_homebrew_token
with:
app_id: ${{ secrets.UPDATECLIBOT_APP_ID }}
private_key: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }}
- name: GoReleaser
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.generate_homebrew_token.outputs.token }}
run: |
make release
- name: Clean up
run: |
rm -f ${HOME}/.docker/config.json
40 changes: 40 additions & 0 deletions .github/workflows/updatecli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: updatecli
on:
workflow_dispatch:
push:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Run every hour
- cron: '0 * * * *'
jobs:
updatecli:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Setup updatecli"
uses: "updatecli/updatecli-action@v2.16.2"
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
check-latest: true
id: go
- name: "Run updatecli in dryrun"
run: "updatecli diff --config ./updatecli/updatecli.d"
env:
UPDATECLI_GITHUB_ACTOR: ${{ github.actor }}
UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: tibdex/github-app-token@v1.7
id: generate_token
if: github.ref == 'refs/heads/main'
with:
app_id: ${{ secrets.UPDATECLIBOT_APP_ID }}
private_key: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }}
- name: "Run updatecli"
if: github.ref == 'refs/heads/main'
run: "updatecli apply --config ./updatecli/updatecli.d"
env:
UPDATECLI_GITHUB_ACTOR: ${{ secrets.UPDATECLI_BOT_GITHUB_ACTOR }}
UPDATECLI_GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

0 comments on commit d1dc337

Please sign in to comment.