Merge branch 'main' of github.com:cvele/hass-addons #35
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 MongoDB | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "mongodb/*" | |
- ".github/workflows/release-mongodb.yml" | |
permissions: | |
contents: write | |
pull-requests: read | |
packages: write | |
jobs: | |
release: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Extract Version from mongodb/config.json | |
id: extract_version | |
run: | | |
VERSION=$(jq -r '.version' mongodb/config.json) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Update CHANGELOG.md | |
run: | | |
echo "### Version ${{ env.VERSION }}" > temp_CHANGELOG.md | |
git log -1 --pretty=format:%B >> temp_CHANGELOG.md | |
echo "" >> temp_CHANGELOG.md | |
cat mongodb/CHANGELOG.md >> temp_CHANGELOG.md | |
mv temp_CHANGELOG.md mongodb/CHANGELOG.md | |
git add mongodb/CHANGELOG.md | |
- name: Commit CHANGELOG.md | |
run: | | |
git add mongodb/CHANGELOG.md | |
git commit -m "Update CHANGELOG.md for version ${{ env.VERSION }}" | |
git push origin HEAD:${{ github.ref }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/#-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: mongodb | |
platforms: linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/cvele/hass-mongodb:${{ env.VERSION }} | |
ghcr.io/cvele/hass-mongodb:latest |