replace .circleci with github workflows

This commit is contained in:
Dawid Wysokiński 2021-10-28 07:48:59 +02:00
parent 3635d1aebf
commit 95c630f6ac
Signed by: Kichiyaki
GPG Key ID: EF14026D247EB867
2 changed files with 46 additions and 49 deletions

View File

@ -1,49 +0,0 @@
version: 2
jobs:
build_latest:
docker:
- image: circleci/node:14.18.1-browsers
working_directory: ~/zdamegzzawodowyadminpanel
steps:
- checkout
- setup_remote_docker:
version: 20.10.2
- run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image
- run: docker build -t $DOCKER_LOGIN/zdam-egzamin-zawodowy-admin-panel:latest .
# deploy the image
- run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-admin-panel:latest
build_version:
docker:
- image: circleci/node:14.18.1-browsers
working_directory: ~/zdamegzzawodowyadminpanel
steps:
- checkout
- setup_remote_docker:
version: 20.10.2
- run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image
- run: docker build -t $DOCKER_LOGIN/zdam-egzamin-zawodowy-admin-panel:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') .
# deploy the image
- run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-admin-panel:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//')
workflows:
version: 2
deploy_latest:
jobs:
- build_latest:
context: Zdam-Egzamin-Zawodowy
filters:
branches:
only:
- master
deploy_version:
jobs:
- build_version:
context: Zdam-Egzamin-Zawodowy
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/

46
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,46 @@
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: .
tags: |
${{ secrets.REGISTRY_NAME }}/zdam-egzamin-zawodowy-admin-panel:latest
${{ secrets.REGISTRY_NAME }}/zdam-egzamin-zawodowy-admin-panel:${{ steps.get_version.outputs.VERSION }}
file: ./Dockerfile
push: true