BUMP: minimum node version required to 16 #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
name: npm-publish | |
on: | |
push: | |
branches: | |
- master # Change this to your default branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
# outputs: | |
# status: ${{ steps.ID.conclusion }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- run: npm ci | |
- name: Wait for CI action to succeed | |
uses: fountainhead/action-wait-for-check@297be350cf8393728ea4d4b39435c7d7ae167c93 | |
# This is tagged version v1.1.0, but do not use version tags | |
# https://julienrenaux.fr/2019/12/20/github-actions-security-risk/ | |
id: wait-for-build | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: ci-status | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
intervalSeconds: 20 | |
timeoutSeconds: 240 | |
- name: CI action build OK | |
if: steps.wait-for-build.outputs.conclusion == 'success' | |
run: exit 0 | |
- name: CI action build FAIL | |
if: steps.wait-for-build.outputs.conclusion != 'success' | |
run: exit 1 | |
test-version: | |
needs: build | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.check.outputs.changed || false }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: Check if version has been updated | |
id: check | |
uses: EndBug/version-check@8240855b2dbd43fc1c3c628d7aa75cfa07b76ab4 | |
# This is tagged version v2.1.2, but do not use version tags | |
# https://julienrenaux.fr/2019/12/20/github-actions-security-risk/ | |
with: | |
diff-search: true | |
publish-npm: | |
needs: test-version | |
runs-on: ubuntu-latest | |
if: needs.test-version.outputs.status == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- name: Publish if version has been updated | |
uses: pascalgn/npm-publish-action@374314eadce0ca5353387666469a949f69414752 | |
# This is tagged version v1.3.9, but do not use version tags | |
# https://julienrenaux.fr/2019/12/20/github-actions-security-risk/ | |
with: # All of theses inputs are optional | |
tag_name: "v%s" | |
tag_message: "v%s" | |
commit_pattern: "^Release (\\S+)" | |
workspace: "." | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings | |
publish-gpr: | |
needs: test-version | |
runs-on: ubuntu-latest | |
if: needs.test-version.outputs.status == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
- name: Update package name | |
run: | | |
sudo npm install -g json | |
REGISTRY_NAME=`json registryNames.github -f package.json` | |
json -I -f package.json -e this.name=\"$REGISTRY_NAME\" | |
- name: Publishing new package | |
run: | | |
npm ci | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-aur: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup ssh key | |
run: | | |
mkdir "$HOME/.ssh/" | |
echo -e "${{ secrets.AUR_AUTH_KEY }}" > "$HOME/.ssh/aur" | |
sudo chmod 600 "$HOME/.ssh/aur" | |
ssh-keygen -y -f "$HOME/.ssh/aur" > "$HOME/.ssh/aur.pub" | |
sudo chmod 600 "$HOME/.ssh/aur.pub" | |
echo -e "Host aur.archlinux.org\n IdentityFile $HOME/.ssh/aur" > "$HOME/.ssh/config" | |
eval "$(ssh-agent -s)" | |
ssh-add "$HOME/.ssh/aur" | |
- name: Clone aur repository | |
run: | | |
ssh -o StrictHostKeyChecking=no aur@aur.archlinux.org uptime || echo "" | |
echo -e "[user]\nemail = theo.cousinet@epitech.eu\nname = Theo\n" > "$HOME/.gitconfig" | |
git clone --depth=1 ssh://aur@aur.archlinux.org/blih_cli-git.git | |
- name: Update PKGBUILD file # eg: v0.2.0-16-g13e7cc3 -> 0.2.0_16_g13e7cc3 -> update PKGBUILD file | |
run: | | |
PKGVER=`git show --format=\"%H\" --no-patch | git describe --tags | sed 's/v//' | sed 's/-/_/g'` | |
if [ -z "$PKGVER" ];then exit 1; fi; | |
cd blih_cli-git/ | |
sed -Ei "s/pkgver=.*/pkgver=$PKGVER/" PKGBUILD | |
sed -Ei "s/pkgver = .*/pkgver = $PKGVER/" .SRCINFO | |
- name: Publishing new package | |
run: | | |
rm -rf .git/ | |
cd blih_cli-git/ | |
git add -A | |
git commit -m "github action auto update" | |
git push |