From 4515a4c06a29c4c08fa7cb821cd424a6f60e898b Mon Sep 17 00:00:00 2001 From: Sunny Guduru Date: Thu, 7 Mar 2024 16:29:33 -0800 Subject: [PATCH] feat: Adding release please (#4) feat: We added release please. Currently it only does a github release (hopefully) --- .github/actions/publish/action.yml | 44 ++++++++++++++++++++++ .github/actions/release-secrets/action.yml | 38 +++++++++++++++++++ .github/variables/go-versions.env | 2 + .github/workflows/release-please.yml | 19 ++++++++++ changelog.md | 6 +++ 5 files changed, 109 insertions(+) create mode 100644 .github/actions/publish/action.yml create mode 100644 .github/actions/release-secrets/action.yml create mode 100644 .github/variables/go-versions.env create mode 100644 .github/workflows/release-please.yml create mode 100644 changelog.md diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml new file mode 100644 index 00000000..0ceecbbc --- /dev/null +++ b/.github/actions/publish/action.yml @@ -0,0 +1,44 @@ +name: Publish Artifacts +description: 'Publish artifacts to Github Release' +inputs: + token: + description: 'Token to use for publishing.' + required: true + dry-run: + description: 'Is this a dry run. If so no package will be published.' + required: false + default: 'true' + tag: + description: 'Tag to upload artifacts to.' + required: true + +runs: + using: composite + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386 + - name: Git clean + shell: bash + run: git clean -f + - name: Login to Docker + shell: bash + run: | + echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin + - name: Run Goreleaser + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release --clean ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }} + env: + GITHUB_TOKEN: ${{ inputs.token }} + + - name: Upload Release Artifacts + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.token }} + run: | + gh release upload ${{ inputs.tag }} ./dist/*.deb ./dist/*.rpm ./dist/*.tar.gz ./dist/*.txt --clobber \ No newline at end of file diff --git a/.github/actions/release-secrets/action.yml b/.github/actions/release-secrets/action.yml new file mode 100644 index 00000000..42af064a --- /dev/null +++ b/.github/actions/release-secrets/action.yml @@ -0,0 +1,38 @@ +name: Release Secrets +# Currently this handles SSM, but once we need an s3 secret we should add support. +description: 'Action for getting release secrets from SSM' +inputs: + aws_assume_role: + description: 'The ARN of an AWS IAM role to assume. Used to auth with AWS to upload results to S3.' + required: true + # This uses this format to allow using the GetParameters action. + ssm_parameter_pairs: + description: 'A series of pairs of paths to environment mappings. "/path = ENV_NAME, /path2 = ENV_NAME2"' + required: false + # If we add S3, then just have a list of S3 paths. + s3_path_pairs: + description: 'A series of pairs of s3 paths to local paths. The local paths are relative to the project root. "some/s3/path = local-path/file"' + required: false + +runs: + using: composite + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + audience: https://github.com/launchdarkly + role-to-assume: ${{ inputs.aws_assume_role }} + aws-region: us-east-1 + - name: Load environment variables + uses: dkershner6/aws-ssm-getparameters-action@4fcb4872421f387a6c43058473acc1b22443fe13 + if: ${{ inputs.ssm_parameter_pairs != '' }} + with: + parameterPairs: ${{ inputs.ssm_parameter_pairs }} + withDecryption: 'true' + - name: Download S3 files + shell: bash + if: ${{ inputs.s3_path_pairs != '' }} + env: + PATH_PAIRS: ${{ inputs.s3_path_pairs }} + run: | + source $GITHUB_ACTION_PATH/s3-copy.sh diff --git a/.github/variables/go-versions.env b/.github/variables/go-versions.env new file mode 100644 index 00000000..fb1f664f --- /dev/null +++ b/.github/variables/go-versions.env @@ -0,0 +1,2 @@ +latest=1.22.1 +penultimate=1.21.8 \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..a1270084 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,19 @@ +name: Run Release Please + +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + steps: + - uses: google-github-actions/release-please-action@v4 + id: release + with: + token: ${{secrets.GITHUB_TOKEN}} + release-type: "go" \ No newline at end of file diff --git a/changelog.md b/changelog.md new file mode 100644 index 00000000..07947185 --- /dev/null +++ b/changelog.md @@ -0,0 +1,6 @@ +## [0.0.1] - 2024-03-06 + +### Added + +- CI tests +- Hardcoded wizards \ No newline at end of file