From 59a186f464b8850db6d042166b680b1def328c24 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 6 Dec 2022 00:11:42 +1100 Subject: [PATCH] Revert "feat: pre-build dockerfile (#201)" This reverts commit 60b1f441e2ceeb5de5b75858cfb98403276f5d4a. --- .dockerignore | 10 --- .github/workflows/build-docker-image.yml | 77 ------------------------ .github/workflows/lint.yml | 14 ++--- .github/workflows/main.yml | 6 +- .github/workflows/test.yml | 7 +-- Dockerfile | 14 +++-- action.yml | 20 +++--- prebuild.Dockerfile | 12 ---- 8 files changed, 27 insertions(+), 133 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .github/workflows/build-docker-image.yml delete mode 100644 prebuild.Dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 26f83d9b..00000000 --- a/.dockerignore +++ /dev/null @@ -1,10 +0,0 @@ -#Ignore logs -logs/ -*.log - -#Ignore the git and cache folders -.git -.cache - -#Ignore Temp files -*.tmp diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml deleted file mode 100644 index 6a4d77b1..00000000 --- a/.github/workflows/build-docker-image.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Build & Publish Docker Image - -# This workflow builds the prebuild.Dockerfile and publishes the image to the GitHub Container Registry if the build is successful. - -on: - workflow_dispatch: - push: - branches: - - master - -permissions: - packages: write - contents: read - -env: - IMAGE_NAME: ${{ github.repository }} - IMAGE_TAG: ${{ github.sha }} - REGISTRY: ghcr.io - -jobs: - build: - timeout-minutes: 15 - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Generate Docker Metadata - id: meta - uses: docker/metadata-action@v4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - images: | - ${{ env.IMAGE_NAME }} - ghcr.io/user${{ env.IMAGE_NAME }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - - name: Set up QEMU To support build amd64 and arm64 images - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - id: docker_build - with: - push: ${{ github.event_name != 'pull_request' }} - context: . - file: ./prebuild.Dockerfile - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Output image, digest and metadata to summary - run: | - { - echo imageid: "${{ steps.docker_build.outputs.imageid }}" - echo digest: "${{ steps.docker_build.outputs.digest }}" - echo labels: "${{ steps.meta.outputs.labels }}" - echo tags: "${{ steps.meta.outputs.tags }}" - echo version: "${{ steps.meta.outputs.version }}" - } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1a2ecbbe..74d189d8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,6 @@ name: Lint on: - workflow_dispatch: pull_request: types: - opened @@ -17,7 +16,7 @@ permissions: jobs: lint-bash: name: Lint Bash scripts - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: reviewdog/action-shellcheck@v1 @@ -26,12 +25,12 @@ jobs: reporter: github-pr-review level: warning path: . - pattern: "*.sh" + pattern: '*.sh' fail_on_error: true lint-dockerfile: name: Lint Dockerfiles - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: hadolint @@ -43,7 +42,7 @@ jobs: hadolint_ignore: DL3016 DL3018 # Ignore pinning apk and npm packages to specific version with @ lint-actions: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Lint Github Actions @@ -53,8 +52,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: reporter: github-pr-review - github_token: ${{ secrets.GITHUB_TOKEN }} - tool_name: actionlint - level: warning - fail_on_error: true - filter_mode: added diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60910e73..8f4a8e6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,6 @@ name: Bump version on: - workflow_dispatch: pull_request: types: - closed @@ -15,8 +14,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: "0" - ref: ${{ github.ref_name }} + fetch-depth: '0' - name: version-tag id: tag @@ -48,4 +46,4 @@ jobs: git push -f origin "$major" # add vX as 1 is linked to short sha bug https://github.com/anothrNick/github-tag-action/actions/runs/3139501775/jobs/5099976842#step:1:35 git tag -f "v$major" - git push -f origin "v$major" + git push -f origin "v$major" \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ea0f5ea..2081e12f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,6 @@ name: Test # This workflow tests the tag action and can be used on PRs to detect (some) breaking changes. on: - workflow_dispatch: pull_request: types: - opened @@ -14,17 +13,16 @@ permissions: pull-requests: write checks: write contents: read - packages: read jobs: test-action: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: "0" + fetch-depth: '0' # Use the action to generate a tag for itself - name: Test action main @@ -88,3 +86,4 @@ jobs: fi # todo add test for #none bump + diff --git a/Dockerfile b/Dockerfile index 05d1bf65..b64fc5be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ -# hadolint ignore=DL3007 -FROM ghcr.io/anothrnick/github-tag-action:latest - -LABEL "repository"="https://github.com/anothrnick/github-tag-action" -LABEL "homepage"="https://github.com/anothrnick/github-tag-action" +FROM node:16-alpine +LABEL "repository"="https://github.com/anothrNick/github-tag-action" +LABEL "homepage"="https://github.com/anothrNick/github-tag-action" LABEL "maintainer"="Nick Sjostrom" -# This Dockerfile is empty, it simply pulls a prebuilt image to speed up the Action. +RUN apk --no-cache add bash git curl jq && npm install -g semver + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index ae6b9ff5..360e4f5f 100644 --- a/action.yml +++ b/action.yml @@ -1,16 +1,16 @@ -name: "Github Tag Bump" -description: "Bump and push git tag on merge" -author: "Nick Sjostrom" +name: 'Github Tag Bump' +description: 'Bump and push git tag on merge' +author: 'Nick Sjostrom' runs: - using: "docker" - image: "Dockerfile" + using: 'docker' + image: 'Dockerfile' outputs: new_tag: - description: "Generated tag" + description: 'Generated tag' tag: - description: "The latest tag after running this action" + description: 'The latest tag after running this action' part: - description: "The part of version which was bumped" + description: 'The part of version which was bumped' branding: - icon: "git-merge" - color: "purple" + icon: 'git-merge' + color: 'purple' diff --git a/prebuild.Dockerfile b/prebuild.Dockerfile deleted file mode 100644 index 84dd6109..00000000 --- a/prebuild.Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM node:16-alpine - -LABEL "repository"="https://github.com/anothrnick/github-tag-action" -LABEL "homepage"="https://github.com/anothrnick/github-tag-action" -LABEL "maintainer"="Nick Sjostrom" - -# hadolint ignore=DL3016,DL3018 -RUN apk --no-cache add bash git curl jq && npm install -g semver - -COPY entrypoint.sh /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"]