Skip to content

cron-release

cron-release #15

Workflow file for this run

name: 'cron-release'
on:
# FIXME: manual run
workflow_dispatch:
# run daily, 3:00 UTC
schedule:
- cron: '56 2 * * *'
jobs:
pr-checks:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Checkout pulp-ui (main)'
uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 128
- name: 'Skip if no real changes since last npm version update'
run: |
LAST=`git blame package.json | grep '"version":' | awk '{ print $1 }'`
if git diff --exit-code "$LAST" -- src/ package.json; then
false
else
true
fi
- name: 'Install node 20'
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
# FIXME: reuse pr-checks.yml?
- name: 'Checks'
run: |
# fail if npm install had to change package-lock.json
npm install
git diff --exit-code package-lock.json
# dependencies
npm run lint-setup
# run linters
npm run lint
# run test
npm run test
- name: 'Set PULP_UI_VERSION'
run: |
# used in npm run build
echo "PULP_UI_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: "git config"
run: |
git config --local user.name "cron-release workflow"
git config --local user.email "pulp-ui+cron-release@example.com"
- name: 'Update gettext'
run: |
npm run gettext:extract
npm run gettext:compile
git add locale/
git commit -m "locale update on $(date --iso=d)" || true
- name: 'Increment npm version, version tag'
run: 'npm version patch'
- name: 'Set NPM_VERSION, TARBALL'
run: |
echo "NPM_VERSION=$(jq -r .version < package.json)" >> $GITHUB_ENV
echo "TARBALL=pulp-ui-$(date --iso=d).tar.gz" >> $GITHUB_ENV
- name: 'Build UI dist/'
run: 'npm run build'
- name: "Build a tarball"
run: |
tar -C dist/ -czvf "$TARBALL" .
- name: "Push, push tags"
run: |
git push
git push -f --tags
- name: "Release"
run: |
gh release create v"$NPM_VERSION" --title "pulp-ui $NPM_VERSION $(date --iso=d)" --generate-notes
gh release upload v"$NPM_VERSION" "$TARBALL" --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}