Skip to content

Commit

Permalink
feat: add snapcraft support
Browse files Browse the repository at this point in the history
  • Loading branch information
kvendingoldo committed May 1, 2024
1 parent 64a9d2c commit eff1ea8
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/snap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: "Snapcraft Release Pipeline"

on:
release:
types: [released]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: snapcore/action-build@v1
id: build

- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ steps.build.outputs.snap }}
release: edge

# - uses: snapcore/action-publish@v1
# with:
# store_login: ${{ secrets.STORE_LOGIN }}
# snap: ${{ steps.build.outputs.snap }}
# release: edge



- name: Update chocolatey checksums
run: |
echo "[INFO] Wait until all artefacts will be uploaded"
sleep 300
release_tag=${{ github.event.release.tag_name }}
release_version="${release_tag#v}"
echo "[INFO] Download release's checksums"
curl \
-SsL \
-o /tmp/checksums.txt \
https://github.com/tofuutils/tenv/releases/download/${release_tag}/tenv_${release_tag}_checksums.txt
echo "[INFO] Update chocolateyinstall.ps1"
choco_url="https://github.com/tofuutils/tenv/releases/download/${release_tag}/tenv_${release_tag}_Windows_i386.zip"
choco_url64="https://github.com/tofuutils/tenv/releases/download/${release_tag}/tenv_${release_tag}_Windows_x86_64.zip"
choco_sum="$(grep "tenv_${release_tag}_Windows_i386.zip" /tmp/checksums.txt | cut -d ' ' -f 1 | tr -d '\n')"
choco_sum64="$(grep "tenv_${release_tag}_Windows_x86_64.zip" /tmp/checksums.txt | cut -d ' ' -f 1 | tr -d '\n')"
sed -i "s~\$url = '.*'~\$url = '${choco_url}'~g" tenv/tools/chocolateyinstall.ps1
sed -i "s~\$url64 = '.*'~\$url64 = '${choco_url64}'~g" tenv/tools/chocolateyinstall.ps1
sed -i "s~\$checksum = '.*'~\$checksum = '${choco_sum}'~g" tenv/tools/chocolateyinstall.ps1
sed -i "s~\$checksum64 = '.*'~\$checksum64 = '${choco_sum64}'~g" tenv/tools/chocolateyinstall.ps1
echo "[INFO] Push changes back to git"
git config user.name tofuutils
git config user.email tofuutils@github.com
git add -A
git commit -m "Chocolatey scripts update for tenv version ${release_tag}"
git tag -a ${release_version} -m "${release_version}"
git push origin --tags main
56 changes: 56 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@


name: tenv
summary: Version manager for OpenTofu, Terraform and Terragrunt, written in Go.
description: |
tenv is a versatile version manager for [OpenTofu](https://opentofu.org), [Terraform](https://www.terraform.io/) and [Terragrunt](https://terragrunt.gruntwork.io/),
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.
tenv is a successor of [tofuenv](https://github.com/tofuutils/tofuenv) and [tfenv](https://github.com/tfutils/tfenv).
adopt-info: tenv
version: git
base: core22
confinement: devmode #strict
parts:
tenv:
plugin: go
source: .
build-snaps: [ go ]
build-packages: [ pkg-config, libzstd-dev ]
build-environment:
- CGO_ENABLED: 0
- CGO_LDFLAGS_ALLOW: ".*"
# tenv:
# plugin: go
# source-type: git
# source: https://github.com/get-woke/woke
# override-pull: |
# snapcraftctl pull
# snapcraftctl set-version \
# "$(git describe --long --tags --always --match=v*.*.* | sed 's/v//')"
apps:
tenv:
command: cmd/tenv
plugs:
- home
- dot-config-woke
- network
- removable-media
golang-classic-example:
command: bin/main

grade: devel #stable
architectures:
- build-on: amd64
- build-on: armhf
- build-on: arm64

#plugs:
# dot-config-woke:
# interface: personal-files
# read:
# - $HOME/.config/woke.yaml
# - $HOME/.config/woke.yml
# - $HOME/.woke.yaml
# - $HOME/.woke.yml

0 comments on commit eff1ea8

Please sign in to comment.