Skip to content

Release

Release #56

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version_increment:
description: 'La version a incrémenter (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- 'major'
- 'minor'
- 'patch'
# build_docker_image:
# description: "Construire l'image docker ?"
# required: true
# default: true
# type: boolean
# latest:
# description: "Tagger l'image docker avec le tag 'latest' ?"
# required: true
# default: true
# type: boolean
jobs:
# build-docker:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# packages: write
# steps:
# - name: Build docker
# uses: Libertech-FR/lt-actions/release@main
# with:
# version_increment: ${{ github.event.inputs.version_increment }}
# build_docker_image: ${{ github.event.inputs.build_docker_image }}
# latest: ${{ github.event.inputs.latest }}
# repository: ${{ github.repository }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# access_token: ${{ secrets.GITHUB_TOKEN }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
# # Optional parameters, thoses are default values :
# registry: 'ghcr.io'
# context: .
build-pkg:
runs-on: ubuntu-latest
# using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Git
shell: bash
run: |
git config user.email "[email protected]"
git config user.name "Github Action"
echo ${{ secrets.GITHUB_TOKEN }} > token.txt
git config credential.helper "store --file=token.txt"
- name: Update version
shell: bash
run: |
echo NEW_VERSION=$(yarn version --${{ inputs.version_increment }} --json | jq -r '.data | select(contains("New version")) | split(":")[1] | gsub(" ";"")') >> $GITHUB_ENV
env:
REF: ${{ github.ref }}
- name: Push to unprotected branch
shell: bash
run: |
git push --follow-tags
env:
REF: ${{ github.ref }}
# - name: Push to protected branch
# uses: CasperWA/push-protected@v2
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: main
# unprotect_reviews: true
# tags: true
- name: Publish release
uses: ncipollo/release-action@v1
with:
name: Release ${{ env.NEW_VERSION }}
commit: ${{ env.REF }}
draft: false
prerelease: false
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: ${{ inputs.latest }}
tag: ${{ env.NEW_VERSION }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- run: npm install -g yarn
- run: yarn --frozen-lockfile
- run: npm install --global pkg
- run: yarn build
# - run: curl -sf https://gobinaries.com/tj/node-prune | sh
# - run: node-prune
- name: Build
run: pkg dist/main.js -o sesame-daemon --targets linux,macos,win -C Brotli
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: sesame-daemon-linux
path: sesame-daemon-linux
- name: Download a Build Artifact
uses: actions/download-artifact@v3
with:
name: sesame-daemon-linux
- name: Init deb package
run: |
mkdir -p .debpkg/usr/bin
cp sesame-daemon-linux .debpkg/usr/bin/sesame-daemon
mkdir -p .debpkg/var/lib/sesame-daemon/backends
cp -r ./backends.example .debpkg/var/lib/sesame-daemon
chmod +x .debpkg/DEBIAN/postinst
chmod +x .debpkg/DEBIAN/postrm
- name: Set Package Version
run: |
echo "PACKAGE_VERSION=$(cat package.json | jq .version -r)" >> $GITHUB_ENV
- name: Create deb package
uses: jiro4989/build-deb-action@v3
with:
package: sesame-daemon
package_root: .debpkg
maintainer: Libertech-FR
version: ${{ env.PACKAGE_VERSION }} # ${{ github.ref }} # refs/tags/v*.*.*
arch: 'amd64'
desc: 'Sesame Daemon'
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sesame-daemon*
tag: ${{ env.NEW_VERSION }}
overwrite: true
file_glob: true