Skip to content

Commit

Permalink
feat: export pre-built docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchief committed Nov 5, 2021
1 parent 83cc09d commit 8a51696
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 41 deletions.
81 changes: 42 additions & 39 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
# 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/[email protected]
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
Expand Down Expand Up @@ -81,6 +82,8 @@ jobs:
uses: docker/[email protected]
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/[email protected]
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
Expand All @@ -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@<tag|sha|branch>
```

Once this step runs it'll set the following environment variables for subsequent steps:

```shell
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 1.2.0
version: 1.4.0

0 comments on commit 8a51696

Please sign in to comment.