Skip to content

Commit

Permalink
Asm 11497 release steampipe plugin akeyless (#6)
Browse files Browse the repository at this point in the history
Steampipe Plugin Akeyless pipeline
  • Loading branch information
michelsk authored Jul 8, 2024
1 parent b9a4af4 commit bcc182a
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/merge_main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Merge Main

on:
workflow_dispatch:
deployment:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Git Tag
run: |
version=$(cat "${GITHUB_WORKSPACE}/version" | sed -n '/v[0-9]\{1,\}.[0-9]\{1,\}.[0-9]\{1,\}/p')
git tag -a $version -m "tagged $version"
git push origin $version
85 changes: 83 additions & 2 deletions .github/workflows/release_steampipe.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,89 @@
name: Release Steampipe Plugin Akeyless

on:
workflow_dispatch:
push:
tags:
- 'v*'

env:
SERVICES_BUCKET_AWS: akeylessservices

jobs:
deploy:
build:
name: Build And Release
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
steps:
- run: echo "placeholder"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set environment variables
run: |
plugin_name=$(echo $GITHUB_REPOSITORY | cut -d'-' -f 3)
echo $plugin_name
echo "PLUGIN_NAME=${plugin_name}" >> $GITHUB_ENV
- name: Exit if goreleaser file is missing
run: |
test -f .goreleaser.yml
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.2

- name: Get latest version tag
run: |-
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Trim tag
run: |-
echo $version
trim=${version#"v"}
echo $trim
echo "version=${trim}" >> $GITHUB_ENV
- name: Validate Version String
run: |-
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version is valid: $version"
else
echo "Version is invalid: $version"
exit 1
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean --skip=publish --timeout=60m

- name: List Build Artifacts
run: ls -laR ./dist

- name: Connect to AWS using Github OIDC role
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_GITHUB_STEAMPIPE_OIDC_ROLE_PRODUCTION }}
aws-region: us-east-2

- name: Copy files to AWS S3 bucket
run: |
aws s3 cp ./dist s3://"${SERVICES_BUCKET_AWS}/services/steampipe-plugin-akeyless/release/${version}/" --recursive --exclude "*" --include "*.gz"
- name: Slack Notification
if: failure() || success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: 'operations'
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: 'Release Latest Steampipe Plugin Akeyless, Status: ${{ job.status }}!'
SLACK_MESSAGE: 'Version:${{ env.version }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_OPERATIONS_WEBHOOK }}
MSG_MINIMAL: true
SLACK_FOOTER: Akeyless.io Release Steampipe Plugin Akeyless Pipeline
36 changes: 36 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
- GO111MODULE=on
- GOPRIVATE=github.com/akeylesslabs
goos:
- linux
- darwin

goarch:
- amd64
- arm64

id: "steampipe"
binary: "{{ .ProjectName }}.plugin"
flags:
- -tags=netgo

archives:
- format: gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
files:
- none*
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
2 changes: 2 additions & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Use Semantic versioning only. Please update the version number before opening a pull request.
v0.0.3

0 comments on commit bcc182a

Please sign in to comment.