Skip to content

Commit

Permalink
chore: Add some Github Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyvy-vi authored Jul 11, 2021
2 parents 446bb17 + ca033c6 commit 354feb9
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Changelog
on:
workflow_dispatch:
push:
branches:
- main

jobs:
changelog:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.CHANGELOG_RELEASE }}
version-file: './meta.json'
output-file: 'CHANGELOG.md'

- name: Create Release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.CHANGELOG_RELEASE }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
62 changes: 62 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "CodeQL"

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
paths-ignore:
- .github/**

schedule:
- cron: '39 6 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# 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@v1

# ℹ️ 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@v1
36 changes: 36 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Docker image
on:
workflow_dispatch:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: check out the repo
uses: actions/checkout@v2
- name: get project version
id: get_version
run: |
echo ::set-output name=version_tag::$(cat ./meta.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
echo "project version - v${{ steps.get_version.outputs.version_tag }}"
- name: version dockerfile
run: sed -i 's/v0.0.0/v${{ steps.get_version.outputs.version_tag}}/g' Dockerfile
- name: set up Docker builder
uses: docker/setup-buildx-action@v1
- name: log into GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: push to Github Container Registry
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/metafam/shepherd-bot:v${{ steps.get_version.outputs.version_tag}}
ghcr.io/metafam/shepherd-bot:latest

0 comments on commit 354feb9

Please sign in to comment.