Tune left side panel margin #813
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: CI | |
on: | |
push: | |
pull_request: | |
release: | |
types: [published] | |
workflow_dispatch: | |
schedule: | |
- cron: "23 2 12 * *" | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
outputs: | |
version: ${{ steps.get_version.outputs.VERSION }} | |
create_release: ${{ steps.check_release.outputs.CREATE_RELEASE }} | |
steps: | |
- name: Get build version | |
id: get_version | |
run: | | |
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT | |
echo "Version: ${GITHUB_REF##*/}" | |
# Releases created via the GitHub webGUI will also create and push a tag. | |
# Both events will trigger this workflow, so we cancel the run for tags and allow it for releases. | |
- name: Check if workflow is running for a tagged release | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
id: check_release | |
run: | | |
URL="https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.get_version.outputs.VERSION }}" | |
StatusCode=$(curl -o -I -L -s -w "%{http_code}" -X GET -G $URL) | |
if [ "$StatusCode" == 200 ]; then | |
echo "GitHub release already exists: stopping this workflow.\nSee parallel `Release` workflow." | |
echo "CREATE_RELEASE=false" >> $GITHUB_OUTPUT | |
else | |
echo "Tag pushed without release: building and creating a new GitHub release." | |
echo "CREATE_RELEASE=true" >> $GITHUB_OUTPUT | |
fi | |
provision-environment: | |
needs: [prepare] | |
# Run workflow proper for: github releases, tag pushes without github release and regular pushes (not tag) | |
if: github.event_name == 'release' || needs.prepare.outputs.create_release == 'true' || !contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: '2' | |
- name: Install npm dependencies | |
id: npm_install | |
run: | | |
echo 'Installing npm dependencies ...' | |
rm -fr node-modules | |
npm ci | |
- name: 'Tar workspace' | |
run: tar -cvf workspace.tar . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: workspace | |
path: workspace.tar | |
retention-days: 1 | |
lintJS: | |
needs: [provision-environment] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: workspace | |
- name: 'Untar workspace' | |
run: tar -xf workspace.tar | |
- name: Lint Javascript | |
id: lint_js | |
run: gulp lintjs | |
lintSCSS: | |
needs: [provision-environment] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: workspace | |
path: . | |
- name: 'Untar workspace' | |
run: tar -xf workspace.tar | |
- name: Lint SCSS | |
id: lint_js | |
run: gulp lintscss | |
build: | |
needs: [prepare, lintJS, lintSCSS] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: workspace | |
- name: 'Untar workspace' | |
run: tar -xf workspace.tar | |
- name: Build | |
run: sh -x ./build.sh ci | |
env: | |
THEME_VERSION: ${{ needs.prepare.outputs.version }} | |
- name: Upload build package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: drupal-theme-build-package | |
path: dist/clarin_bootstrap-${{ needs.prepare.outputs.version }}.tar.gz | |
publish: | |
needs: [prepare, build] | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Get latest commit sha and message | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '1' | |
- name: Get build package from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: drupal-theme-build-package | |
- name: 'Untar build package' | |
run: tar -xf clarin_bootstrap-${{ needs.prepare.outputs.version }}.tar.gz | |
- name: Publish to distribution repository | |
uses: s0/git-publish-subdir-action@master | |
env: | |
REPO: [email protected]:clarin-eric/clarin-drupal-bootstrap-theme-dist.git | |
BRANCH: ${{ needs.prepare.outputs.version }}.x | |
FOLDER: clarin_bootstrap | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_DEPLOY_DIST_KEY }} | |
MESSAGE: "Updated from https://github.com/clarin-eric/clarin-drupal-bootstrap-theme/commit/{sha}\nLast commit message:\n{msg}" | |
SKIP_EMPTY_COMMITS: true | |
release: | |
needs: [prepare, publish] | |
# Run job for github releases and tag pushes (without github release) | |
if: github.event_name == 'release' || needs.prepare.outputs.create_release == 'true' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download build package from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: drupal-theme-build-package | |
# For github releases -> upload release package to existing release | |
# For tag pushes without github release -> create a github release with release package | |
- name: Create prelease for this tag | |
if: needs.prepare.outputs.create_release == 'true' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.prepare.outputs.version }} | |
release_name: Release ${{ needs.prepare.outputs.version }} | |
draft: true | |
prerelease: true | |
- uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# Pseudo-ternary expression: get "upload_url" from the release created above, or from github "release" event when release is pre-created | |
upload_url: ${{ needs.prepare.outputs.create_release == 'true' && steps.create_release.outputs.upload_url || github.event.release.upload_url }} | |
asset_path: ./clarin_bootstrap-${{ needs.prepare.outputs.version }}.tar.gz | |
asset_name: clarin_bootstrap-${{ needs.prepare.outputs.version }}.tar.gz | |
asset_content_type: application/tar+gzip | |
- uses: eregon/publish-release@v1 | |
if: needs.prepare.outputs.create_release == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} |