Skip to content

Commit

Permalink
feat: add snap support
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Sharov <[email protected]>
  • Loading branch information
kvendingoldo committed Jun 5, 2024
1 parent dd1ff1a commit 6f65848
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 65 deletions.
65 changes: 0 additions & 65 deletions .github/workflows/publish-snap.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ jobs:
mv cosign-linux-amd64 /usr/local/bin/cosign
chmod +x /usr/local/bin/cosign
- name: Import GPG key
run: |
GPG_KEY_FILE=/tmp/signing-key.gpg
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode > "${GPG_KEY_FILE}"
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import
GPG_FINGERPRINT=$(gpg --list-secret-keys --keyid-format LONG | awk '/^sec/{sub(/.*\//, "", $2); print $2; exit}')
echo "GPG_FINGERPRINT=${GPG_FINGERPRINT}" >>"${GITHUB_ENV}"
echo "GPG_KEY_FILE=${GPG_KEY_FILE}" >> "${GITHUB_ENV}"
env:
GPG_TTY: /dev/ttys000 # Set the GPG_TTY to avoid issues with pinentry

- name: Setup snapcraft
run: |
sudo snap install snapcraft --classic --channel=7.x/stable
# See https://github.com/goreleaser/goreleaser/issues/1715
mkdir -p "$HOME/.cache/snapcraft/download"
mkdir -p "$HOME/.cache/snapcraft/stage-packages"
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand All @@ -37,6 +60,8 @@ jobs:
args: release --clean -f ${{ vars.GORELEASER_CONFIG_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.TENV_GITHUB_TOKEN }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_TOKEN }}

docker-ghcr:
name: 'Build and release docker image to github container registry'
runs-on: ubuntu-latest
Expand All @@ -46,16 +71,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push docker image
uses: docker/build-push-action@v5
with:
Expand All @@ -72,16 +101,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.registry_url }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push docker image
uses: docker/build-push-action@v5
with:
Expand Down
43 changes: 43 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ checksum:
name_template: "{{ .ProjectName }}_{{ .Tag }}_checksums.txt"
algorithm: sha256

signs:
- artifacts: all
signature: "${artifact}.gpgsig"
id: gpg
cmd: gpg
args: [ "--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}" ]

nfpms:
- file_name_template: "{{ .ProjectName }}_{{- .Tag }}_{{ .Arch }}"
maintainer: "https://github.com/dvaumoron"
Expand Down Expand Up @@ -272,6 +279,42 @@ nfpms:
pkgbase: tenv
packager: tofuutils <[email protected]>

snapcrafts:
- name: tenv
publish: true
summary: OpenTofu, Terraform, Terragrunt, and Atmos version manager, written in Go.
description: |
tenv is a versatile version manager for OpenTofu, Terraform, Terragrunt and Atmos, written in Go.
Our tool simplifies the complexity of handling different versions of these powerful tools,
ensuring developers and DevOps professionals
can focus on what matters most - building and deploying efficiently.
disable: 'false'
channel_templates:
- 'latest/stable'
grade: 'stable'
confinement: classic
license: Apache-2.0
base: core22
apps:
tenv:
command: tenv
aliases: [ tenv ]
tofu:
command: tofu
aliases: [ tofu ]
terraform:
command: terraform
aliases: [ terraform ]
terragrunt:
command: terragrunt
aliases: [ terragrunt ]
tf:
command: tf
aliases: [ tf ]
atmos:
command: atmos
aliases: [ atmos ]

# chocolateys:
# - name: tenv
# # Empty means all IDs.
Expand Down

0 comments on commit 6f65848

Please sign in to comment.