Skip to content

Commit 4b86eeb

Browse files
committed
⌛️ ci: Add GitHub actions
1 parent 1942bf1 commit 4b86eeb

5 files changed

Lines changed: 179 additions & 2 deletions

File tree

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"
12+
assignees:
13+
- "tomy0000000"
14+
commit-message:
15+
prefix: "🧹 chore: "
16+
reviewers:
17+
- "tomy0000000"

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
uses: docker/metadata-action@v3
107107
with:
108108
images: |
109-
${{ github.repository_owner }}/k-backend
109+
${{ secrets.DOCKER_USERNAME }}/k-backend
110110
ghcr.io/${{ github.repository_owner }}/k-backend
111111
tags: |
112112
type=edge
@@ -117,7 +117,7 @@ jobs:
117117
- name: Login to DockerHub
118118
uses: docker/login-action@v1
119119
with:
120-
username: ${{ github.repository_owner }}
120+
username: ${{ secrets.DOCKER_USERNAME }}
121121
password: ${{ secrets.DOCKER_PASSWORD }}
122122

123123
- name: Login to GitHub Container Registry
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [main]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [main]
20+
schedule:
21+
- cron: "0 16 * * 5"
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: ["python"]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v1
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

.github/workflows/docker-docs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Docs (Docker Hub)
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update-readme:
9+
name: Update Docker Hub README
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Update Repository Description
16+
uses: peter-evans/dockerhub-description@v2
17+
with:
18+
username: ${{ secrets.DOCKER_USERNAME }}
19+
password: ${{ secrets.DOCKER_PASSWORD }}
20+
short-description: ${{ github.event.repository.description }}

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Build and Push Image
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event_name != 'workflow_dispatch' }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Docker Meta
19+
id: meta
20+
uses: docker/metadata-action@v3
21+
with:
22+
images: |
23+
${{ secrets.DOCKER_USERNAME }}/k_backend
24+
ghcr.io/${{ github.repository_owner }}/k_backend
25+
tags: |
26+
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
27+
type=semver,pattern={{major}}.{{minor}}
28+
type=semver,pattern={{version}}
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v1
32+
33+
- name: Login to DockerHub
34+
uses: docker/login-action@v1
35+
with:
36+
username: ${{ secrets.DOCKER_USERNAME }}
37+
password: ${{ secrets.DOCKER_PASSWORD }}
38+
39+
- name: Login to GitHub Container Registry
40+
uses: docker/login-action@v1
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.repository_owner }}
44+
password: ${{ github.token }}
45+
46+
- name: Build and Push
47+
uses: docker/build-push-action@v2
48+
with:
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
52+
# deployment:
53+
# name: Deploy to Production
54+
# runs-on: ubuntu-latest
55+
# environment: Production
56+
# needs: build
57+
# steps:
58+
# - name: SSH and execute deployment
59+
# uses: appleboy/ssh-action@master
60+
# with:
61+
# host: ${{ secrets.HOST }}
62+
# port: ${{ secrets.PORT }}
63+
# username: ${{ secrets.USERNAME }}
64+
# key: ${{ secrets.KEY }}
65+
# script_stop: true
66+
# script: |
67+
# cd k_backend
68+
# docker pull tomy0000000/k_backend:latest
69+
# docker-compose up --detach
70+
# docker network connect nginx_default k_backend_app

0 commit comments

Comments
 (0)