Skip to content

Commit

Permalink
Add container release to spacectl
Browse files Browse the repository at this point in the history
Signed-off-by: peterdeme <snypox@gmail.com>
  • Loading branch information
peterdeme committed May 9, 2023
1 parent b8a98eb commit 61dc0c7
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ jobs:
goreleaser:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
packages: write

steps:
- name: Checkout
Expand All @@ -16,6 +20,21 @@ jobs:
uses: actions/setup-go@v4
with: { go-version: 1.19 }

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with: { platforms: linux/arm64 }

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
Expand All @@ -30,11 +49,10 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
args: release --clean ${{ startsWith(github.ref, 'refs/tags/v') && '' || '--snapshot' }}
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ archives:
- format: zip
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

dockers:
- use: buildx
goarch: amd64
build_flag_templates: ["--platform=linux/amd64"]
image_templates: ["ghcr.io/spacelift-io/spacectl:{{ .Version }}-amd64"]

- use: buildx
goarch: arm64
build_flag_templates: ["--platform=linux/arm64"]
image_templates: ["ghcr.io/spacelift-io/spacectl:{{ .Version }}-arm64"]

docker_manifests:
- name_template: ghcr.io/spacelift-io/spacectl:{{ .Version }}
image_templates:
- ghcr.io/spacelift-io/spacectl:{{ .Version }}-amd64
- ghcr.io/spacelift-io/spacectl:{{ .Version }}-arm64

- name_template: ghcr.io/spacelift-io/spacectl:latest
image_templates:
- ghcr.io/spacelift-io/spacectl:{{ .Version }}-amd64
- ghcr.io/spacelift-io/spacectl:{{ .Version }}-arm64

checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM alpine
COPY spacectl /usr/local/bin/spacectl
ENTRYPOINT ["/usr/local/bin/spacectl"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ asdf install spacectl latest
asdf global spacectl latest
```

### Docker image

`spacectl` is distributed as a Docker image, which can be used as follows:

```bash
docker run -it --rm ghcr.io/spacelift-io/spacectl stack deploy --id my-infra-stack
```

> Don't forget to add the [requied environment variables](#authenticating-using-environment-variables) in order to authenticate.
### GitHub Release

Alternatively, `spacectl` is distributed through GitHub Releases as a zip file containing a self-contained statically linked executable built from the source in this repository. Binaries can be download directly from the [Releases page](https://github.com/spacelift-io/spacectl/releases).
Expand Down

0 comments on commit 61dc0c7

Please sign in to comment.