replace circleci with github workflows
This commit is contained in:
parent
1c6c6da482
commit
e1a849c310
|
@ -1,51 +0,0 @@
|
||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build_latest:
|
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.17
|
|
||||||
working_directory: ~/twhelpdcbot
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
# start proprietary DB using private Docker image
|
|
||||||
# with credentials stored in the UI
|
|
||||||
- run: |
|
|
||||||
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
||||||
# build the application image
|
|
||||||
- run: docker build -t $DOCKER_LOGIN/twhelp-dcbot:latest .
|
|
||||||
# deploy the image
|
|
||||||
- run: docker push $DOCKER_LOGIN/twhelp-dcbot:latest
|
|
||||||
build_version:
|
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.17
|
|
||||||
working_directory: ~/twhelpdcbot
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
# start proprietary DB using private Docker image
|
|
||||||
# with credentials stored in the UI
|
|
||||||
- run: |
|
|
||||||
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
||||||
# build the application image
|
|
||||||
- run: docker build -t $DOCKER_LOGIN/twhelp-dcbot:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') .
|
|
||||||
# deploy the image
|
|
||||||
- run: docker push $DOCKER_LOGIN/twhelp-dcbot:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//')
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
deploy_latest:
|
|
||||||
jobs:
|
|
||||||
- build_latest:
|
|
||||||
context: TWHelp
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
deploy_version:
|
|
||||||
jobs:
|
|
||||||
- build_version:
|
|
||||||
context: TWHelp
|
|
||||||
filters:
|
|
||||||
tags:
|
|
||||||
only: /^v.*/
|
|
||||||
branches:
|
|
||||||
ignore: /.*/
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
name: Build and push to registry
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push_to_registry:
|
||||||
|
name: Push Docker image to Docker Hub
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Get the version
|
||||||
|
id: get_version
|
||||||
|
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.REGISTRY_LOGIN }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Push to Docker Hub
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||||
|
tags: |
|
||||||
|
${{ secrets.REGISTRY_NAME }}/twhelp-dcbot:latest
|
||||||
|
${{ secrets.REGISTRY_NAME }}/twhelp-dcbot:${{ steps.get_version.outputs.VERSION }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
|
@ -29,7 +29,4 @@ ENV APP_MODE=production
|
||||||
ENV GIN_MODE=release
|
ENV GIN_MODE=release
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait ./wait
|
CMD ./twhelpdcbot
|
||||||
RUN chmod +x ./wait
|
|
||||||
|
|
||||||
CMD ./wait && ./twhelpdcbot
|
|
||||||
|
|
Reference in New Issue