From a1b26e68ae6e25970235db87a2227cda5576e03b Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Wed, 21 Aug 2024 10:09:21 -0600 Subject: [PATCH] Fixed automatic builds with docker container --- .github/workflows/build-container.yml | 48 --------------------------- .github/workflows/main.yml | 8 +++-- .goreleaser.yaml | 18 ++++++++++ 3 files changed, 24 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/build-container.yml diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml deleted file mode 100644 index 2fad61e..0000000 --- a/.github/workflows/build-container.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: build and publish containers -on: - workflow_dispatch: - push: - tags: - - v* -permissions: - packages: write - contents: read -jobs: - build-magellan: - runs-on: ubuntu-latest - steps: - - name: check out the repo - uses: actions/checkout@v4 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: | - ghcr.io/openchami/magellan - - # generate Docker tags based on the following events/attributes - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern=v{{version}} - type=semver,pattern=v{{major}}.{{minor}} - type=semver,pattern=v{{major}} - type=sha - - name: setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to github container repo - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push magellan - uses: docker/build-push-action@v5 - with: - platforms: linux/amd64 - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97aaf48..22349aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,8 +11,6 @@ permissions: write-all # Necessary for the generate-build-provenance action with jobs: build: - - runs-on: ubuntu-latest steps: @@ -20,6 +18,12 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.21 + - name: Docker Login + uses: docker/login-action@v3 + with: + registry :ghcr.io + username: ${{ gihub.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v4 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7e7b51d..4ce72ea 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -25,6 +25,24 @@ archives: - CHANGELOG.md - README.md - bin/magellan.sh +dockers: + - + image_templates: + - ghcr.io/openchami/{{.ProjectName}}:latest + - ghcr.io/openchami/{{.ProjectName}}:{{ .Tag }} + - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }} + - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}.{{ .Minor }} + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + extra_files: + - LICENSE + - CHANGELOG.md + - README.md + - bin/magellan.sh checksum: name_template: 'checksums.txt' snapshot: