Skip to content

ci: Release 2.2.2

ci: Release 2.2.2 #35

Workflow file for this run

# Stolen from https://github.com/mrchief/aws-creds-okta-action/blob/master/.github/workflows/autorelease.yml
name: Auto Release
on:
pull_request:
types: [closed]
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository}}
jobs:
github-release:
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:
version: ${{ 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-docker-image:
needs: github-release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{needs.github-release.outputs.version }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}