Skip to content

Commit

Permalink
🔀 Merge pull request #1602 from Lissy93/BUILD/repo-docker-tagging
Browse files Browse the repository at this point in the history
BUILD/ Update taging and release workflows
  • Loading branch information
Lissy93 authored May 25, 2024
2 parents 19b24d9 + 4474ccc commit 6db97b0
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 49 deletions.
7 changes: 5 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
*Thank you for contributing to Dashy! So that your PR can be handled effectively, please populate the following fields (delete sections that are not applicable)*
<!--
Thank you for contributing to Dashy!
So that your PR can be handled effectively, please populate the following fields
-->

**Category**:
> One of: Bugfix / Feature / Code style update / Refactoring Only / Build related changes / Documentation / Other (please specify)
Expand All @@ -20,5 +23,5 @@
- [ ] There are no (new) build warnings or errors
- [ ] _(If a new config option is added)_ Attribute is outlined in the schema and documented
- [ ] _(If a new dependency is added)_ Package is essential, and has been checked out for security or performance
- [ ] Bumps version, if new feature added
- [ ] _(If significant change)_ Bumps version in package.json

44 changes: 0 additions & 44 deletions .github/workflows/auto-tag-pr.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/create-tag-for-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# When Dashy's version in package.json is updated
# this workflow will create a new tag
# And then publish it to the repository
name: 🏗️ Tag on Version Change

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'package.json'

jobs:
tag-if-version-updated:
runs-on: ubuntu-latest

steps:
- name: Check Out Repository 🛎️
uses: actions/checkout@v2

- name: Set Up Python 🐍
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Extract Version from package.json 🔢
id: package_version
run: |
import json
with open('package.json', 'r') as f:
version = json.load(f)['version']
print(f"::set-output name=VERSION::{version}")
shell: python

- name: Get Latest Tag 🏷️
id: latest_tag
run: |
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null)
echo "::set-output name=TAG::${latest_tag:-0}"
- name: Create and Push Tag ⤴️
if: steps.package_version.outputs.VERSION != steps.latest_tag.outputs.TAG && steps.latest_tag.outputs.TAG != '0'
run: |
git config --local user.email "[email protected]"
git config --local user.name "Liss-Bot"
git tag -a ${{ steps.package_version.outputs.VERSION }} -m "Release v${{ steps.package_version.outputs.VERSION }}"
git push origin ${{ steps.package_version.outputs.VERSION }}
env:
GIT_AUTHOR_NAME: Liss-Bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Liss-Bot
GIT_COMMITTER_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Scans, builds and releases a multi-architecture docker image
name: 🐳 Build + Publish Multi-Platform Image

on:
workflow_dispatch:
push:
branches: ['master']
tags: [v*]
tags: ['v*']
paths:
- '**.js'
- 'src/**'
Expand Down Expand Up @@ -48,7 +47,7 @@ jobs:
ghcr.io/${{ env.GH_IMAGE }}
tags: |
type=ref,event=tag,prefix=release-,suffix={{tag}}
type=semver,pattern={{raw}},value=${{ steps.package-version.outputs.version }}
type=semver,pattern={{major}}.x,value=${{ steps.package-version.outputs.version }}
labels: |
maintainer=Lissy93
org.opencontainers.image.title=Dashy
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 🏗️ Draft New Release

on:
push:
tags:
- '*.*.*'

jobs:
create-draft-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code 🛎️
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need all history for generating release notes

- name: Create Draft Release 📝
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
generate_release_notes: true

- name: Output new release URL ↗️
run: 'echo "Draft release URL: ${{ steps.create_release.outputs.html_url }}"'

0 comments on commit 6db97b0

Please sign in to comment.