From ae1d4e385f76812f46431e9a516c77b5b6ceb3d5 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Fri, 21 Jun 2024 13:14:30 +0100 Subject: [PATCH] Remove old GitHub Actions --- .github/actions/docker-build/action.yml | 44 ---------------------- .github/actions/get-version-tag/action.yml | 21 ----------- .github/workflows/cd.yml | 18 --------- .github/workflows/remove-untagged.yml | 18 --------- 4 files changed, 101 deletions(-) delete mode 100644 .github/actions/docker-build/action.yml delete mode 100644 .github/actions/get-version-tag/action.yml diff --git a/.github/actions/docker-build/action.yml b/.github/actions/docker-build/action.yml deleted file mode 100644 index e1d4642..0000000 --- a/.github/actions/docker-build/action.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build Docker image - -inputs: - version: - required: true - type: string - latest: - required: false - type: boolean - default: false - github-token: - required: true - type: string - docker-image-name: - required: true - type: string - -runs: - using: "composite" - steps: - - uses: actions/checkout@v4 - - name: Log in to registry - run: echo "${{ inputs.github-token }}" | docker login ghcr.io -u $ --password-stdin - shell: bash - - uses: hadolint/hadolint-action@v3.1.0 - with: - dockerfile: Dockerfile - ignore: DL3045,DL3007 - - name: Build and push image - run: | - IMAGE_ID=$(echo "ghcr.io/${{ github.repository_owner }}/${{ inputs.docker-image-name }}" | tr '[A-Z]' '[a-z]') - echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_OUTPUT" - echo $IMAGE_ID - docker build --tag $IMAGE_ID:${{ inputs.version }} --platform=linux/amd64 --no-cache . - docker push $IMAGE_ID:${{ inputs.version }} - shell: bash - - name: Tag latest - if: inputs.latest - run: | - IMAGE_ID=$(echo "ghcr.io/${{ github.repository_owner }}/${{ inputs.docker-image-name }}" | tr '[A-Z]' '[a-z]') - echo $IMAGE_ID - docker tag $IMAGE_ID:${{ inputs.version }} $IMAGE_ID:latest - docker push $IMAGE_ID:latest - shell: bash diff --git a/.github/actions/get-version-tag/action.yml b/.github/actions/get-version-tag/action.yml deleted file mode 100644 index 4f3f29c..0000000 --- a/.github/actions/get-version-tag/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Get version tag - -outputs: - version-tag: - description: "Version tag" - value: ${{ steps.version-tag.outputs.VERSION }} - -runs: - using: "composite" - steps: - - id: version-tag - name: Get tag from branch, tag or release - run: | - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "main" ] && VERSION=develop - [ "$VERSION" == "develop" ] && VERSION=develop - echo "Version: $VERSION" - echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" - shell: bash diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9ea7e74..67693f0 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,24 +8,6 @@ concurrency: group: cd-${{ github.ref }} jobs: - # build-old: - # runs-on: ubuntu-latest - # permissions: - # packages: write - # contents: read - # steps: - # - uses: actions/checkout@v4 - # - name: Get tag - # id: version-tag - # uses: ./.github/actions/get-version-tag - # - name: Build Docker image - # uses: ./.github/actions/docker-build - # with: - # version: ${{ steps.version-tag.outputs.version-tag }} - # latest: true - # github-token: ${{ secrets.GITHUB_TOKEN }} - # docker-image-name: ${{ vars.DOCKER_IMAGE_NAME }} - build: runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/remove-untagged.yml b/.github/workflows/remove-untagged.yml index bf80d79..dbd8f52 100644 --- a/.github/workflows/remove-untagged.yml +++ b/.github/workflows/remove-untagged.yml @@ -8,25 +8,7 @@ on: jobs: remove-untagged: runs-on: ubuntu-latest - # env: - # PER_PAGE: 100 steps: - # - name: Delete untagged images - # uses: actions/github-script@v7.0.1 - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const response = await github.request("GET /orgs/${{ github.repository_owner }}/packages/container/${{ vars.DOCKER_IMAGE_NAME }}/versions", - # { per_page: ${{ env.PER_PAGE }} - # }); - # for(version of response.data) { - # if (version.metadata.container.tags.length == 0 && version.name !== "latest" && version.name !== "preview") { - # console.log("Delete " + version.id) - - # const deleteResponse = await github.request("DELETE /orgs/${{ github.repository_owner }}/packages/container/${{ vars.DOCKER_IMAGE_NAME }}/versions/" + version.id, { }); - # console.log("status " + deleteResponse.status) - # } - # } - name: Remove untagged Docker images uses: nationalarchives/ds-docker-actions/.github/actions/remove-untagged@main with: