From 8a51696dce61315145acb4dea5fbc970b8d3f094 Mon Sep 17 00:00:00 2001 From: Hrusikesh Panda Date: Fri, 5 Nov 2021 16:13:10 -0400 Subject: [PATCH] feat: export pre-built docker image --- .github/workflows/autorelease.yml | 81 ++++++++++++++++--------------- CHANGELOG.md | 10 ++++ README.md | 8 ++- manifest.yml | 2 +- 4 files changed, 60 insertions(+), 41 deletions(-) diff --git a/.github/workflows/autorelease.yml b/.github/workflows/autorelease.yml index eb21eb3..b0b9056 100644 --- a/.github/workflows/autorelease.yml +++ b/.github/workflows/autorelease.yml @@ -4,48 +4,49 @@ on: types: [closed] branches: - master - workflow_dispatch: jobs: - # build: - # if: github.event.pull_request.merged == true && contains(toJSON(github.event.pull_request.labels.*.name), '"autorelease"') - # runs-on: ubuntu-latest - # env: - # manifest_file: 'manifest.yml' - # changelog_file: 'CHANGELOG.md' - # steps: - # - uses: actions/checkout@v2 - # with: - # ref: master - # - name: get version - # id: version - # run: | - # sed -n 's/^version:\s\(.*\)$/\1/p' ${{ env.manifest_file }} | xargs -I {} echo "::set-output name=version::{}" - # - name: get changelog - # id: changelog - # run: | - # changelog=$(echo "${{ steps.version.outputs.version}}" | xargs -I {} sed -n '/^#\s'"{}"'.*$/,/^#\s\([^[:space:]]\+\).*$/{//!p}' ${{ env.changelog_file }}) - # echo $changelog - # changelog="${changelog//'%'/'%25'}" - # changelog="${changelog//$'\n'/'%0A'}" - # changelog="${changelog//$'\r'/'%0D'}" - # echo "::set-output name=changelog::$changelog" - # - name: echo version and changelog - # run: | - # echo "${{ steps.version.outputs.version}}" - # echo "${{ steps.changelog.outputs.changelog }}" - # - name: Create Release - # uses: ncipollo/release-action@v1.4.0 - # with: - # name: ${{ steps.version.outputs.version }} - # tag: v${{ steps.version.outputs.version }} - # body: ${{ steps.changelog.outputs.changelog}} - # draft: false - # prerelease: false - # # An optional tag for the release. If this is omitted the git ref will be used (if it is a tag). - # token: ${{ secrets.GITHUB_TOKEN }} + build: + if: github.event.pull_request.merged == true && contains(toJSON(github.event.pull_request.labels.*.name), '"autorelease"') + runs-on: ubuntu-latest + env: + manifest_file: 'manifest.yml' + changelog_file: 'CHANGELOG.md' + outputs: + output1: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v2 + with: + ref: master + - name: get version + id: version + run: | + sed -n 's/^version:\s\(.*\)$/\1/p' ${{ env.manifest_file }} | xargs -I {} echo "::set-output name=version::{}" + - name: get changelog + id: changelog + run: | + changelog=$(echo "${{ steps.version.outputs.version}}" | xargs -I {} sed -n '/^#\s'"{}"'.*$/,/^#\s\([^[:space:]]\+\).*$/{//!p}' ${{ env.changelog_file }}) + echo $changelog + changelog="${changelog//'%'/'%25'}" + changelog="${changelog//$'\n'/'%0A'}" + changelog="${changelog//$'\r'/'%0D'}" + echo "::set-output name=changelog::$changelog" + - name: echo version and changelog + run: | + echo "${{ steps.version.outputs.version}}" + echo "${{ steps.changelog.outputs.changelog }}" + - name: Create Release + uses: ncipollo/release-action@v1.4.0 + with: + name: ${{ steps.version.outputs.version }} + tag: v${{ steps.version.outputs.version }} + body: ${{ steps.changelog.outputs.changelog}} + draft: false + prerelease: false + # An optional tag for the release. If this is omitted the git ref will be used (if it is a tag). + token: ${{ secrets.GITHUB_TOKEN }} build-and-push-image: - #needs: build + needs: build runs-on: ubuntu-latest env: REGISTRY: ghcr.io @@ -81,6 +82,8 @@ jobs: uses: docker/metadata-action@v3.6.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}},value=${{needs.build.outputs.version}} - name: Build and push Docker image uses: docker/build-push-action@v2.7.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index ed569da..c7685bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 1.4.0 - 5-11-2021 +### Features + +- use semver on docker image + +# 1.3.0 - 5-11-2021 +### Features + +- export pre-built docker image + # 1.2.0 - 21-9-2021 ### Features diff --git a/README.md b/README.md index 022bfda..0ec4094 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Here's an example. All options are required except `okta_mfa_method` which defau ```yaml - name: Create AWS profile - uses: mrchief/aws-creds-okta@master # or a tagged release version + uses: docker://ghcr.io/mrchief/aws-creds-okta@v1.2.1 # or a tagged release version with: aws_role_arn: arn:aws:iam::account-id:role/role-name okta_username: okta.user@mycompany.com @@ -17,6 +17,12 @@ Here's an example. All options are required except `okta_mfa_method` which defau okta_mfa_seed: ${{ secrets.OKTA_MFA_SEED }} ``` +💡 **Note** You can also use the non docker image version of the action by switching to: + +``` + uses: mrchief/aws-creds-okta@ +``` + Once this step runs it'll set the following environment variables for subsequent steps: ```shell diff --git a/manifest.yml b/manifest.yml index 3f0a2ab..84b2e83 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1 +1 @@ -version: 1.2.0 +version: 1.4.0