Merge pull request #266 from FACT-Finder/renovate/npm-express-vulnera… #36
Workflow file for this run
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
name: release | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-node_modules- | |
- run: yarn --frozen-lockfile | |
- name: Get Version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- run: yarn lerna run build | |
env: | |
BUILD_VERSION: ${{ env.VERSION }} | |
- name: upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: packages/snage/build/npm | |
release-docker-npm: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: packages/snage/build/npm | |
- name: Get Version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Publish Release to Docker and NPM | |
run: | | |
echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > $HOME/.npmrc | |
docker build -t snage/snage:${VERSION} packages/snage | |
docker push snage/snage:${VERSION} | |
(cd packages/snage && yarn publish --new-version "${VERSION}" --no-git-tag-version) | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
release-artifact: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: packages/snage/build/npm | |
- name: Get Version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Create release artifact | |
run: | | |
mkdir -p packages/snage/build/github/snage-${VERSION} | |
cp -r LICENSE packages/snage/build/npm/snage.js packages/snage/build/npm/ui packages/snage/build/github/snage-${VERSION} | |
tar -cvzf snage-${VERSION}.tar.gz -C packages/snage/build/github snage-${VERSION} | |
RELEASE_ID=$(curl "https://api.github.com/repos/FACT-Finder/snage/releases/tags/v${VERSION}" | jq -r '.id') | |
curl \ | |
--fail \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Content-type: application/gzip" \ | |
--data-binary @snage-${VERSION}.tar.gz \ | |
"https://uploads.github.com/repos/FACT-Finder/snage/releases/${RELEASE_ID}/assets?name=snage-${VERSION}.tar.gz" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release-aur: | |
runs-on: ubuntu-latest | |
needs: [build, release-artifact] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
- name: Get Version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Publish to Archlinux User Repository | |
run: | | |
mkdir $HOME/.ssh | |
echo "$SSH_KEY" > $HOME/.ssh/id_rsa | |
chmod 700 $HOME/.ssh && chmod 600 $HOME/.ssh/id_rsa | |
ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts | |
git clone ssh://[email protected]/snage.git aur-snage | |
( | |
cd aur-snage; | |
sed -i -E 's/pkgrel=[0-9]+/pkgrel=1/g' PKGBUILD; | |
sed -i -E "s/pkgver=[0-9.]+/pkgver=${VERSION}/g" PKGBUILD; | |
bash updpkgsums-printsrcinfo-build.sh; | |
git config user.email "[email protected]"; | |
git config user.name "SnageCI"; | |
git add PKGBUILD .SRCINFO; | |
git commit -m "Update to version ${VERSION}"; | |
git push; | |
) | |
git clone ssh://[email protected]/snage-bin.git aur-snage-bin | |
( | |
cd aur-snage-bin; | |
sed -i -E 's/pkgrel=[0-9]+/pkgrel=1/g' PKGBUILD; | |
sed -i -E "s/pkgver=[0-9.]+/pkgver=${VERSION}/g" PKGBUILD; | |
bash updpkgsums-printsrcinfo-build.sh; | |
git config user.email "[email protected]"; | |
git config user.name "SnageCI"; | |
git add PKGBUILD .SRCINFO; | |
git commit -m "Update to version ${VERSION}"; | |
git push; | |
) | |
env: | |
SSH_KEY: ${{ secrets.SSH_KEY }} |