Skip to content

Commit

Permalink
Prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertuya committed Feb 13, 2024
1 parent 82c65e3 commit 87551e2
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Deploy app when is tagged on main branch (a release is published)
name: release

on:
release:
types: [created]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment, but do not cancel in-progress runs
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4

- name: Prepare release
working-directory: dashgit-web
run: |
chmod u+rx ./prepare-release.sh
./prepare-release.sh "$GITHUB_REF_NAME"
- name: Upload artifact to deploy
uses: actions/upload-pages-artifact@v3.0.1
with:
path: 'dashgit-web/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4.0.4
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Status](https://github.com/javiertuya/dashgit/actions/workflows/test.yml/badge.svg)](https://github.com/javiertuya/dashgit/actions)
[![Run DashGit](https://img.shields.io/badge/%20-Test_Reports-orange)](https://javiertuya.github.io/dashgit)

# DashGit - A Dashboard for GitHub and GitLab repos

This dashboard provides a consolidated view of your latest work items
Expand Down
22 changes: 22 additions & 0 deletions dashgit-web/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Prepares the distribution for release and set version number

# Ensure this script is running in his folder
SCRIPT_DIR=$(readlink -f $0 | xargs dirname)
echo "run command at directory: $SCRIPT_DIR"
cd $SCRIPT_DIR

# Ensure version to set is passed as parameter
VERSION=$1
if test -z "$VERSION"; then
echo "Required parameter: version to set"
exit 1
fi
echo "Set version to $VERSION"

# Copy app files to dist and set version numbers (in index.html and *.js to prevent cache problems)
rm -rf ./dist/
cp -rf ./app ./dist
find ./dist/*.js -type f -exec sed -i "s/.js\"/.js\?v=${VERSION}\"/g" {} \;
sed -i "s/IndexController.js/IndexController.js?v=${VERSION}/g" dist/index.html
sed -i "s/\"v0.0.0-local\"/\"${VERSION}\"/g" dist/Config.js

0 comments on commit 87551e2

Please sign in to comment.