feat: add github flow

This commit is contained in:
Yanislav Igonin 2021-08-28 19:34:34 +03:00
parent 299c44cd73
commit ccdeaaef0a
2 changed files with 106 additions and 0 deletions

18
.github/workflows/push.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Push
on: push, release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
- name: Build
run: go build .
- name: List dir
run: ls

88
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,88 @@
# name: Release
# on:
# release:
# types: [released]
# jobs:
# lint:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Use Node.js 14
# uses: actions/setup-node@v2-beta
# with:
# node-version: 14.x
# - name: Install dependencies
# run: npm ci
# - name: Lint
# run: npm run lint
# build:
# needs: lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Use Node.js 14
# uses: actions/setup-node@v2-beta
# with:
# node-version: 14.x
# - name: Install dependencies
# run: npm ci
# - name: Build
# run: npm run build
# - name: Upload build
# uses: actions/upload-artifact@v2
# with:
# name: dist
# path: dist
# release:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Download build
# uses: actions/download-artifact@v2
# with:
# name: dist
# path: dist
# - name: Build docker image and push to GitHub registry
# uses: docker/build-push-action@v1
# with:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: docker.pkg.github.com
# repository: yanislav-igonin/face-fucker-bot/face-fucker-bot
# dockerfile: production.Dockerfile
# tags: latest, ${{ github.event.release.tag_name }}
# build_args: CI_COMMIT_TAG=${{ github.event.release.tag_name }}
# deploy:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - name: Deploy
# uses: appleboy/ssh-action@master
# env:
# REGISTRY: docker.pkg.github.com/yanislav-igonin/face-fucker-bot
# SERVICE_NAME: face-fucker-bot_app
# with:
# host: ${{ secrets.VPS_HOST }}
# username: ${{ secrets.VPS_SSH_USERNAME }}
# key: ${{ secrets.VPS_SSH_PRIVATE_KEY }}
# script: |
# docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }}
# docker pull ${{ env.REGISTRY }}:${{ github.event.release.tag_name }}
# docker pull ${{ env.REGISTRY }}:latest
# docker service update --image ${{ env.REGISTRY }}:${{ github.event.release.tag_name }} ${{ env.SERVICE_NAME }}