Merge pull request #212 from projectsyn/fix-ci #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
IMAGE: docker.io/${{ github.repository }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set version latest | |
if: github.ref == 'refs/heads/master' | |
run: echo "VERSION=latest" >> ${GITHUB_ENV} | |
- name: Set version from tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> ${GITHUB_ENV} | |
- name: Build Image | |
run: make docker | |
env: | |
IMAGE_NAME: "${IMAGE}:${VERSION}" | |
- name: Push Image | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
docker login docker.io --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" | |
docker push "${IMAGE}:${VERSION}" | |
- name: Build changelog from PRs with labels | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@v3 | |
with: | |
configuration: ".github/changelog-configuration.json" | |
# PreReleases still get a changelog, but the next full release gets a diff since the last full release, | |
# combining possible changelogs of all previous PreReleases in between. | |
# PreReleases show a partial changelog since last PreRelease. | |
ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body: ${{steps.build_changelog.outputs.changelog}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |