Merge pull request #51 from snyk/feat/add-security-quality-gates #48
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 package | |
on: | |
push: | |
branches: | |
- "main" | |
jobs: | |
build: | |
name: Push Latest Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ".node-version" | |
- name: Install dependencies | |
run: npm install | |
- name: Push new tag and release | |
run: | | |
echo "Computing tag using semver..." | |
echo 'deb [trusted=yes] https://apt.fury.io/caarlos0/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list | |
sudo apt update | |
sudo apt install svu=1.7.0 | |
TAG=$(svu) | |
echo "Checking if a release should be done..." | |
if [ $(git tag -l "$TAG") ]; then | |
echo "Tag ${TAG} already exists!" | |
echo "Commit must not generate a new release" | |
else | |
echo "Tag ${TAG} does not exist!" | |
echo "Releasing a new tag ${TAG} with our commits..." | |
# Hard-code user config | |
git config user.email "cloud-config-ro@users.noreply.github.com" | |
git config user.name "Snyk" | |
git status | |
npx release-it | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_ACCESS_TOKEN }} |