Merge branch 'refactoring' into development #272
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
on: | |
push: | |
branches: | |
- main | |
- development | |
tags: | |
- '**' | |
jobs: | |
fetch_version: | |
name: Fetch version information | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
branch: ${{ steps.branch.outputs.branch }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: "Get hitster version" | |
id: version | |
shell: bash | |
run: | | |
cd client | |
npm i @corteks/gitversion | |
export VERSION="$(npm run version --silent)" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: branch | |
update_changelog: | |
needs: ["fetch_version"] | |
if: startsWith(github.ref, 'refs/tags') && !github.event_type != 'pull_request' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
checks: write | |
actions: read | |
issues: read | |
packages: write | |
pull-requests: read | |
repository-projects: read | |
statuses: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: 'main' | |
- name: Update changelog | |
uses: thomaseizinger/[email protected] | |
with: | |
version: ${{ needs.fetch_version.outputs.version }} | |
# In order to make a commit, we need to initialize a user. | |
# You may choose to write something less generic here if you want, it doesn't matter functionality wise. | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "GitHub actions" | |
git config user.email [email protected] | |
- name: Commit changelog | |
run: | | |
git add CHANGELOG.md | |
git commit --message "Prepare release ${{ needs.fetch_version.outputs.version }}" | |
git push | |
push_release_container: | |
name: Push release container to Docker Hub | |
needs: ["update_changelog", "fetch_version"] | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: "Log in to Docker Hub" | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push Docker stable image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: tonironaldbarth/hitster:latest , tonironaldbarth/hitster:${{ needs.fetch_version.outputs.version }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
HITSTER_VERSION=${{ needs.fetch_version.outputs.version }} | |
HITSTER_BRANCH=${{ needs.fetch_version.outputs.branch }} | |
push_development_container: | |
name: Push development container to Docker Hub | |
needs: ["fetch_version"] | |
if: startsWith(github.ref, 'refs/heads/development') | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: "Log in to Docker Hub" | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push Docker dev image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: tonironaldbarth/hitster:dev | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
HITSTER_VERSION=${{ needs.fetch_version.outputs.version }} | |
HITSTER_BRANCH=${{ needs.fetch_version.outputs.branch }} |