improve release

add workflow
This commit is contained in:
Sylvain Blanc
2023-10-06 16:51:39 +02:00
parent b56419880c
commit 3d63d09891
5 changed files with 70 additions and 32 deletions

View File

@@ -1,24 +0,0 @@
name: Docker CI Unstable
on:
push:
branches: [unstable]
pull_request:
branches: [unstable]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: cyfershepard/jellystat:unstable

View File

@@ -1,9 +1,9 @@
name: Docker CI name: Docker CI
on: on:
push: push:
branches: [main] tags:
pull_request: - "v*.*.*"
branches: [main] branches: [ unstable ]
jobs: jobs:
build: build:
@@ -14,9 +14,22 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: ${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Login to Docker Hub - name: Log in to the Container registry
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
@@ -26,5 +39,5 @@ jobs:
with: with:
context: . context: .
push: true push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: cyfershepard/jellystat:latest

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "jfstat", "name": "jfstat",
"version": "1.0.5", "version": "1.0.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "jfstat", "name": "jfstat",
"version": "1.0.5", "version": "1.0.8",
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.6", "@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6", "@emotion/styled": "^11.10.6",

View File

@@ -1,6 +1,6 @@
{ {
"name": "jfstat", "name": "jfstat",
"version": "1.0.5", "version": "1.0.8",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.6", "@emotion/react": "^11.10.6",

49
release.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
PREVIOUS_VERSION=$(git describe --abbrev=0 --tags)
echo "Choose the version component to increment:"
echo "1. Major"
echo "2. Minor"
echo "3. Patch"
read -p "Enter your choice: " choice
case $choice in
1)
# Increment the major version
MAJOR=$(echo "$PREVIOUS_VERSION" | cut -d. -f1)
MAJOR=$((MAJOR + 1))
NEW_VERSION="$MAJOR.0.0"
;;
2)
# Increment the minor version
MAJOR=$(echo "$PREVIOUS_VERSION" | cut -d. -f1)
MINOR=$(echo "$PREVIOUS_VERSION" | cut -d. -f2)
MINOR=$((MINOR + 1))
NEW_VERSION="$MAJOR.$MINOR.0"
;;
3)
# Increment the patch version
MAJOR=$(echo "$PREVIOUS_VERSION" | cut -d. -f1)
MINOR=$(echo "$PREVIOUS_VERSION" | cut -d. -f2)
PATCH=$(echo "$PREVIOUS_VERSION" | cut -d. -f3)
PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
;;
*)
echo "Invalid choice. Exiting."
exit 1
;;
esac
# Tag message
TAG_MESSAGE="Release version $NEW_VERSION"
# Create a new tag
git tag -a "$NEW_VERSION" -m "$TAG_MESSAGE"
# Push the tag to the remote repository
git push origin "$NEW_VERSION"
echo "Tag $NEW_VERSION has been created and pushed to the remote repository."