From a424a4c73a3528cbf952201316250a5b56e99d18 Mon Sep 17 00:00:00 2001 From: Ryan Parman Date: Tue, 2 Apr 2024 15:42:54 -0600 Subject: [PATCH] Added aws-vault. --- .github/workflows/build-aws-vault.yml | 100 ++++++++++++++++++++++++++ packages/aws-vault/.goreleaser.yml | 32 +++++++++ packages/aws-vault/download.sh | 18 +++++ 3 files changed, 150 insertions(+) create mode 100644 .github/workflows/build-aws-vault.yml create mode 100644 packages/aws-vault/.goreleaser.yml create mode 100644 packages/aws-vault/download.sh diff --git a/.github/workflows/build-aws-vault.yml b/.github/workflows/build-aws-vault.yml new file mode 100644 index 0000000..8faa7e7 --- /dev/null +++ b/.github/workflows/build-aws-vault.yml @@ -0,0 +1,100 @@ +--- +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +################################################################################ +# DO NOT EDIT THIS FILE! +# +# 1. Edit the *.gotmpl.yml files instead. +# 2. go run generate-workflow.go -t _download-and-package.gotmpl.yml -p aws-vault -r '99designs/aws-vault' -c '50 0 * * *' +################################################################################ + +name: Build aws-vault +on: + workflow_dispatch: + push: + branches: [main] + paths: + - ".github/workflows/build-aws-vault.yml" + - "packages/aws-vault/**" + pull_request: + branches: [main] + paths: + - ".github/workflows/build-aws-vault.yml" + - "packages/aws-vault/**" + schedule: + - cron: '50 0 * * *' + +defaults: + run: + shell: bash + +env: + DOCKER_BUILDKIT: 1 + REGISTRY: ${{ vars.REGISTRY }} + +permissions: read-all + +jobs: + lookup: + runs-on: ubuntu-latest + name: Lookup current version + permissions: + packages: write + contents: read + strategy: + fail-fast: false + + container: + image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + outputs: + cache_hit: ${{ steps.check.outputs.cache-hit }} + package_version: ${{ steps.lookup_version.outputs.package_version }} + + steps: + - name: Lookup latest version of package + id: lookup_version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "package_version=$(download-asset latest-tag -r '99designs/aws-vault' -s)" >> $GITHUB_OUTPUT + + - name: Check to see if we've already built this version + uses: actions/cache/restore@v4 + id: check + with: + key: "aws-vault-${{ steps.lookup_version.outputs.package_version }}" + path: "packages/aws-vault/dist" + lookup-only: true + + build: + if: needs.lookup.outputs.cache_hit != 'true' + needs: lookup + name: Build and cache + uses: northwood-labs/package-building/.github/workflows/build-and-cache.yml@main + secrets: inherit + with: + package-name: "aws-vault" + package-version: ${{ needs.lookup.outputs.package_version }} + + upload: + if: needs.lookup.outputs.cache_hit != 'true' + needs: build + name: Upload to S3 + uses: northwood-labs/package-building/.github/workflows/upload-to-s3.yml@main + secrets: inherit + with: + package-name: "aws-vault" + package-version: ${{ needs.lookup.outputs.package_version }} + + metadata: + if: needs.lookup.outputs.cache_hit != 'true' + needs: upload + name: Generate metadata + uses: northwood-labs/package-building/.github/workflows/generate-rpm-meta.yml@main + secrets: inherit diff --git a/packages/aws-vault/.goreleaser.yml b/packages/aws-vault/.goreleaser.yml new file mode 100644 index 0000000..51883b7 --- /dev/null +++ b/packages/aws-vault/.goreleaser.yml @@ -0,0 +1,32 @@ +--- +# https://goreleaser.com/customization/project/ +project_name: aws-vault + +variables: + Vendor: aws-vault authors + VendorHomepage: https://github.com/99designs/aws-vault + License: MIT + Description: |- + A vault for securely storing and accessing AWS credentials in development + environments. + +# https://goreleaser.com/customization/includes/ +includes: + - from_file: + path: ../_dist.yml + - from_file: + path: ../_env.yml + - from_file: + path: ../_builds.yml + - from_file: + path: ../_nightly.yml + - from_file: + path: ../_nfpms.yml + +# https://goreleaser.com/customization/hooks/ +before: + hooks: + - cmd: | + bash ./download.sh + output: true + dir: . diff --git a/packages/aws-vault/download.sh b/packages/aws-vault/download.sh new file mode 100644 index 0000000..d81ab30 --- /dev/null +++ b/packages/aws-vault/download.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +# linux/amd64 (Intel64) +download-asset get \ + --owner-repo "99designs/aws-vault" \ + --pattern "aws-vault-linux-amd64" \ + --archive-path "" \ + --write-to-bin "aws-vault_amd64" \ + ; + +# linux/arm64 (ARM64) +download-asset get \ + --owner-repo "99designs/aws-vault" \ + --pattern "aws-vault-linux-arm64" \ + --archive-path "" \ + --write-to-bin "aws-vault_arm64" \ + ;