From 68814c9dfa774264557e9e35c807508b48cb4294 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Tue, 26 Apr 2022 12:02:29 +0200 Subject: [PATCH] Added GitHub Actions and Workflow Fixes #7 --- .github/actions/build-image/action.yml | 21 +++++++++++++++++++++ .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ version.txt | 1 + 3 files changed, 46 insertions(+) create mode 100644 .github/actions/build-image/action.yml create mode 100644 .github/workflows/ci.yml create mode 100644 version.txt diff --git a/.github/actions/build-image/action.yml b/.github/actions/build-image/action.yml new file mode 100644 index 0000000..5fa4173 --- /dev/null +++ b/.github/actions/build-image/action.yml @@ -0,0 +1,21 @@ +name: 'Build And Publish Image' +description: 'Builds and publishes image' +inputs: + version: + description: 'image tag' + required: true + dockerhub-username: + description: 'dockerhub username' + required: true + dockerhub-password: + description: 'dockerhub password' + required: true +runs: + using: "composite" + steps: + - name: Build and Push image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: springcloud/baseimage:${{ inputs.version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2eb10c0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + workflow_dispatch: + push: + paths-ignore: + - '.github/**' + +jobs: + build: + if: github.repository_owner == 'spring-cloud' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Determine version + run: | + echo baseimage_version=$(cat version.txt) >> $GITHUB_ENV + - name: Build and Publish Images + uses: ./.github/actions/build-images + with: + version: ${{ env.baseimage_version }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..7f20734 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.0.1 \ No newline at end of file