91 lines
2.8 KiB
YAML
91 lines
2.8 KiB
YAML
name: release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: |
|
|
New version for the release
|
|
If the version is in format <major>.<minor>.<patch> a new release is emitted.
|
|
Otherwise for other format ( for example <major>.<minor>.<patch>-beta.1 ), a prerelease is emitted.
|
|
default: "0.0.1"
|
|
required: true
|
|
type: string
|
|
description:
|
|
description: "Version description"
|
|
type: string
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: docker/setup-qemu-action@v2
|
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
- uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: build and publish the docker image
|
|
uses: docker/build-push-action@v4
|
|
id: docker-build
|
|
with:
|
|
push: true
|
|
tags: |
|
|
platane/snk:${{ github.sha }}
|
|
platane/snk:${{ github.event.inputs.version }}
|
|
|
|
- name: update action.yml to point to the newly created docker image
|
|
run: |
|
|
sed -i "s/image: .*/image: docker:\/\/platane\/snk@${{ steps.docker-build.outputs.digest }}/" action.yml
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: yarn
|
|
node-version: 16
|
|
|
|
- name: build svg-only action
|
|
run: |
|
|
yarn install --frozen-lockfile
|
|
yarn build:action
|
|
rm -r svg-only/dist
|
|
mv packages/action/dist svg-only/dist
|
|
|
|
- name: bump package version
|
|
run: yarn version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
|
|
|
|
- name: push new build, tag version and push
|
|
id: push-tags
|
|
run: |
|
|
VERSION=${{ github.event.inputs.version }}
|
|
|
|
git config --global user.email "bot@platane.me"
|
|
git config --global user.name "release bot"
|
|
git add package.json svg-only/dist action.yml
|
|
git commit -m "📦 $VERSION"
|
|
git tag v$VERSION
|
|
git push origin main --tags
|
|
|
|
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
git tag v$( echo $VERSION | cut -d. -f 1-1 )
|
|
git tag v$( echo $VERSION | cut -d. -f 1-2 )
|
|
git push origin --tags --force
|
|
echo "prerelease=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "prerelease=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- uses: ncipollo/release-action@v1.12.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag: v${{ github.event.inputs.version }}
|
|
body: ${{ github.event.inputs.description }}
|
|
prerelease: ${{ steps.push-tags.outputs.prerelease }}
|