From 792d7cd0b85ccfcc57bd1c2af42777635c0fb32d Mon Sep 17 00:00:00 2001 From: Eduardo Vozniak Date: Mon, 2 Oct 2023 13:35:03 -0300 Subject: [PATCH] Bumping version and building the image --- .github/actions/bump-version/action.yaml | 44 ++++++++++++++++++++++++ .github/workflows/ci.yaml | 36 +++++++++---------- 2 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 .github/actions/bump-version/action.yaml diff --git a/.github/actions/bump-version/action.yaml b/.github/actions/bump-version/action.yaml new file mode 100644 index 00000000..12d5f3dc --- /dev/null +++ b/.github/actions/bump-version/action.yaml @@ -0,0 +1,44 @@ +name: Bump Version +description: "This action bumps package version and commits to master" + +inputs: + GH_APP_ID: + description: GitHub app (bot) id to retrieve the token the installation token. + required: true + GH_APP_KEY_BASE64: + description: GitHub app (bot) private key in base64 to retrieve the installation token. + required: true + +outputs: + version: + description: "The version after the bump" + value: ${{ steps.bump-version.outputs.version }} + +runs: + using: "composite" + steps: + - uses: ahmadnassri/action-workflow-queue@v1 + with: + timeout: 3600000 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Bump version + id: bump-version + shell: bash + run: | + pip3 install --root-user-action=ignore --upgrade bumpversion + sudo apt-get update && sudo apt-get install -y xmlstarlet --no-install-recommends + bumpversion patch + version=`cat VERSION` + echo "VERSION=$version" >> "$GITHUB_ENV" + echo "VERSION=$version" >> "$GITHUB_OUTPUT" + echo "changed_files=.bumpversion.cfg,VERSION" >> "$GITHUB_OUTPUT" + + - uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + add: .bumpversion.cfg VERSION diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9f81d3bf..361c8a68 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,23 +76,23 @@ jobs: - name: Checkout uses: actions/checkout@v3 - # - name: Build Docker image - # uses: docker/build-push-action@v4 - # with: - # context: ${{ github.workspace }} - # push: false - # tags: ${{ env.DOCKER_REPO }}:${{ github.run_id }} + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: ${{ github.workspace }} + push: false + tags: ${{ env.DOCKER_REPO }}:${{ github.run_id }} - # - name: Bump Version - # id: bump-version - # uses: philips-internal/pics-workflows/.github/actions/bump-version@v2.10 - # with: - # GH_APP_ID: ${{ secrets.REP_GITHUB_APP_ID }} - # GH_APP_KEY_BASE64: ${{ secrets.REP_GITHUB_APP_KEY_BASE64 }} + - name: Bump Version + id: bump-version + uses: ./.github/actions/bump-version + with: + GH_APP_ID: ${{ secrets.REP_GITHUB_APP_ID }} + GH_APP_KEY_BASE64: ${{ secrets.REP_GITHUB_APP_KEY_BASE64 }} - # - name: Publish Docker image - # uses: docker/build-push-action@v4 - # with: - # context: ${{ github.workspace }} - # push: true - # tags: ${{ env.DOCKER_REPO }}:${{ steps.bump-version.outputs.version }} + - name: Publish Docker image + uses: docker/build-push-action@v4 + with: + context: ${{ github.workspace }} + push: true + tags: ${{ env.DOCKER_REPO }}:${{ steps.bump-version.outputs.version }}