From 692b8325f1cf300895d4f8fcdaac76983294efaf Mon Sep 17 00:00:00 2001 From: j3lte Date: Fri, 4 Nov 2022 06:01:39 +0100 Subject: [PATCH] CI/CD --- .github/workflows/ci.yml | 6 +++--- .github/workflows/deployment.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2521433..a265515 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Docker Image CI on: pull_request: @@ -8,9 +8,9 @@ on: push: paths-ignore: [ "docs/**" ] - jobs: - pytest: + build: + name: CI Build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..63f6881 --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,31 @@ +name: Docker Image Deployment + +on: + push: + tags: ["*.*.*"] + workflow_dispatch: + +env: + IMAGE_NAME: debian-torproxy + +jobs: + build: + name: Build container image + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Get tag + id: tag + uses: dawidd6/action-get-tag@v1 + - name: Login to image-repository , build and push + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - run: | + docker build -f ./Dockerfile . -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + docker tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest