Skip to content

Commit

Permalink
Fixed slug generation
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Aug 29, 2021
1 parent 58c5b3d commit 48037a2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish release

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Publish release
uses: docker://antonyurchenko/git-release:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ALLOW_EMPTY_CHANGELOG: "true"
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).

## [1.0.1] - 2021-08-29
### Added
* *Nothing*

### Changed
* *Nothing*

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* Replaced slug by branch name when generating sub-folder, as the slug is impossible to infer when consuming this action


## [1.0.0] - 2021-08-29
### Added
* First release
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ A GitHub action to deploy preview environments for static apps using GitHub Page

This action expects you to checkout and build your static assets. After that, it will run next steps:

* Generate a unique slug from the branch name plus current date. For example, if your branch is `Update-landing-page`, it will generate a slug like `2021-05-08-update-landing-page`.
* Publish the contents from the folder of your choice into a branch where you should have configured GitHub Pages to be served.
* Use the slug generated in first step to create a sub-folder with your contents. That way, if your repository is `my-org/my-repo`, you will be able to access the preview env in https://my-org.github.io/my-repo/2021-05-08-update-landing-page
* Use the branch name to create a sub-folder with your contents. That way, if your repository is `my-org/my-repo`, you will be able to access the preview env in https://my-org.github.io/my-repo/main
* If you run this action during `pull_request` or `pull_request_target` events: publish a comment after the preview env is ready, with the URL from previous step.

## Usage
Expand All @@ -31,7 +30,7 @@ jobs:
npm run build
- name: Deploy
uses: shlinkio/deploy-preview-action@v1
uses: shlinkio/deploy-preview-action@v1.0.1
with:
branch: gh-pages # The branch from where the GitHub Pages are served (defaults to preview-env)
folder: build # The folder where the artifacts to publish are (defaults to the project root)
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
steps:
- name: Generate slug
id: generate_slug
run: echo "##[set-output name=slug;]$(echo ${GITHUB_HEAD_REF#refs/heads/} | sed -r 's/[~\^]+//g' | sed -r 's/[^a-zA-Z0-9]+/-/g' | sed -r 's/^-+\|-+$//g' | tr A-Z a-z)"
run: echo "##[set-output name=slug;]$(echo ${GITHUB_HEAD_REF#refs/heads/})"
shell: bash
- name: Determine base URL
id: determine_base_url
Expand Down

0 comments on commit 48037a2

Please sign in to comment.