name: Docker Build and Release on: push: branches: - main jobs: build-and-push-on-docker-hub: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - 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.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: . push: true tags: ${{ secrets.DOCKER_USERNAME }}/github-ntfy:latest release-on-github: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Get the latest tag id: get_latest_tag run: echo "latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV - name: Increment version id: increment_version run: | latest_tag=${{ env.latest_tag }} if [ -z "$latest_tag" ]; then new_version="v1.5.2" else IFS='.' read -r -a version_parts <<< "${latest_tag#v}" new_version="v${version_parts[0]}.$((version_parts[1] + 1)).0" fi echo "new_version=$new_version" >> $GITHUB_ENV - name: Read changelog id: read_changelog run: echo "changelog=$(base64 -w 0 CHANGELOG.md)" >> $GITHUB_ENV - name: Decode changelog id: decode_changelog run: echo "${{ env.changelog }}" | base64 -d > decoded_changelog.txt - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.TOKEN }} with: tag_name: ${{ env.new_version }} release_name: Release ${{ env.new_version }} body: ${{ steps.decode_changelog.outputs.changelog }} draft: false prerelease: false