Skip to content

Commit

Permalink
Version [2.9.1]
Browse files Browse the repository at this point in the history
  • Loading branch information
I-am-PUID-0 committed Sep 3, 2024
1 parent daa41ff commit c9a0911
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 34 deletions.
99 changes: 67 additions & 32 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,87 +17,122 @@ jobs:
build-and-push:
runs-on: ubuntu-latest
outputs:
release_exists: ${{ steps.check_release.outputs.release_exists }}
version: ${{ steps.extract_version.outputs.version }}
version: ${{ env.VERSION }}
repo_owner_lower: ${{ env.REPO_OWNER_LOWER }}
repo_name: ${{ env.REPO_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v4

- 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: Extract version from main.py
id: extract_version

- name: Clean up unused Docker images and containers
run: docker system prune --all --force --volumes

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Extract version and set environment variables
id: setup_env_vars
run: |
VERSION=$(grep -Po "(?<=version = ')[^']+" main.py)
REPO_OWNER_LOWER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(basename "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set environment variables
run: |
echo "REPO_OWNER_LOWER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_OWNER_LOWER=$REPO_OWNER_LOWER" >> $GITHUB_ENV
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_ENV
echo "repo_owner_lower=$REPO_OWNER_LOWER" >> $GITHUB_ENV
echo "repo_name=$REPO_NAME" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to Docker Hub and GitHub Registry

- name: Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ env.REPO_NAME }}:${{ env.VERSION }}
${{ secrets.DOCKER_USERNAME }}/${{ env.REPO_NAME }}:latest
ghcr.io/${{ env.REPO_OWNER_LOWER }}/${{ env.REPO_NAME }}:${{ env.VERSION }}
ghcr.io/${{ env.REPO_OWNER_LOWER }}/${{ env.REPO_NAME }}:latest
push: true

release:
needs: build-and-push
runs-on: ubuntu-latest
outputs:
release_exists: ${{ steps.check_release.outputs.release_exists }}
env:
VERSION: ${{ needs.build-and-push.outputs.version }}
REPO_OWNER_LOWER: ${{ needs.build-and-push.outputs.repo_owner_lower }}
REPO_NAME: ${{ needs.build-and-push.outputs.repo_name }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check if Release Exists
id: check_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
run: |
if gh release view ${{ steps.extract_version.outputs.version }} --repo ${{ github.repository }}; then
echo "Release already exists for version ${{ steps.extract_version.outputs.version }}"
echo "release_exists=true" >> $GITHUB_ENV
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "Release does not exist for version ${{ steps.extract_version.outputs.version }}"
echo "release_exists=false" >> $GITHUB_ENV
echo "release_exists=false" >> $GITHUB_OUTPUT
fi
if gh release view "${{ env.VERSION }}" --repo ${{ github.repository }}; then
echo "Release already exists for version ${{ needs.build-and-push.outputs.version }}"
echo "release_exists=true" >> $GITHUB_ENV
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "Release does not exist for version ${{ needs.build-and-push.outputs.version }}"
echo "release_exists=false" >> $GITHUB_ENV
echo "release_exists=false" >> $GITHUB_OUTPUT
fi
- name: Create Release with CHANGELOG Notes
if: steps.check_release.outputs.release_exists == 'false'
if: env.release_exists == 'false'
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_NOTES=$(awk '/^## Version \[${{ steps.extract_version.outputs.version }}\]/ {flag=1; next} /^## Version \[/ {flag=0} flag' CHANGELOG.md)
gh release create ${{ steps.extract_version.outputs.version }} \
--repo ${{ github.repository }} \
--title "Release ${{ steps.extract_version.outputs.version }}" \
--notes "$RELEASE_NOTES" \
--draft=false \
--prerelease=false
RELEASE_NOTES=$(awk '/^## Version \[${{ env.VERSION }}\]/ {flag=1; next} /^## Version \[/ {flag=0} flag' CHANGELOG.md)
gh release create ${{ env.VERSION }} \
--repo ${{ github.repository }} \
--title "Release ${{ env.VERSION }}" \
--notes "$RELEASE_NOTES" \
--draft=false \
--prerelease=false
announce:
needs: build-and-push
if: needs.build-and-push.outputs.release_exists == 'false'
needs: [release, build-and-push]
if: needs.release.outputs.release_exists == 'false'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Post announcement to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## Version [2.9.1] - 2024-09-03 🚀

### Fixed 🐛

- [Issue #68](https://github.com/I-am-PUID-0/pd_zurg/issues/68) Docker Compose fetches incorrect architecture binary on Raspbian arm64 🛠️
- [Issue #69](https://github.com/I-am-PUID-0/pd_zurg/issues/69) Dockerfile pulling the wrong zurg architecture, when running on aarch64 🛠️


## Version [2.9.0] - 2024-08-09 🚀

### Changed 🔄
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def shutdown(signum, frame):
def main():
logger = get_logger()

version = '2.9.0'
version = '2.9.1'

ascii_art = f'''
Expand Down
2 changes: 1 addition & 1 deletion utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def get_architecture(self):
('arm64', 'Linux'): 'linux-arm64',
('arm64', 'Darwin'): 'darwin-arm64',
('aarch64', 'Linux'): 'linux-arm64',
('aarch64', 'Linux'): 'linux-arm-7',
('armv7l', 'Linux'): 'linux-arm-7',
('mips64', 'Linux'): 'linux-mips64',
('mips64le', 'Linux'): 'linux-mips64le',
('ppc64le', 'Linux'): 'linux-ppc64le',
Expand Down

0 comments on commit c9a0911

Please sign in to comment.