Skip to content

Commit 5cc6e27

Browse files
authored
Merge pull request #11 from DealerDotCom/feature/changelog
Create changelog-enforcer.yml
2 parents 978818c + f96da0f commit 5cc6e27

File tree

5 files changed

+83
-14
lines changed

5 files changed

+83
-14
lines changed

.github/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ bundle exec middleman build --clean
2323
## To the internal doc build folder
2424
cd $GITHUB_WORKSPACE
2525
mv /usr/src/app/build $INTERNAL_DOC_BUILD
26+
27+
## Zipping the build to tag them as released in github
28+
echo "Zipping the generated docs"
29+
zip -r $ZIP_DOC_BUILD $EXTERNAL_DOC_BUILD $INTERNAL_DOC_BUILD

.github/workflows/build-deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
env:
1111
external-doc-build: external_build
1212
internal-doc-build: internal_build
13+
zip-doc-build: documents.zip
1314

1415
steps:
1516
- name: Accessing github project files
@@ -22,6 +23,60 @@ jobs:
2223
env:
2324
EXTERNAL_DOC_BUILD: ${{ env.external-doc-build }}
2425
INTERNAL_DOC_BUILD: ${{ env.internal-doc-build }}
26+
ZIP_DOC_BUILD: ${{ env.zip-doc-build }}
27+
28+
- name: Get changes from CHANGELOG.md
29+
id: changelog_reader
30+
uses: mindsers/changelog-reader-action@v2
31+
with:
32+
version: Unreleased
33+
34+
- name: Generate release timestamp
35+
id: tag
36+
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H.%M.%S')"
37+
38+
- name: Push a release tag
39+
id: push_tag
40+
uses: mathieudutour/[email protected]
41+
with:
42+
github_token: ${{ secrets.GH_TOKEN }}
43+
custom_tag: ${{ steps.tag.outputs.date }}
44+
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/[email protected]
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
50+
with:
51+
tag_name: v${{ steps.tag.outputs.date }}
52+
release_name: ${{ steps.tag.outputs.date }}
53+
body: ${{ steps.changelog_reader.outputs.changes }}
54+
prerelease: false
55+
draft: false
56+
57+
- name: Upload Release Asset
58+
uses: actions/[email protected]
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
61+
with:
62+
upload_url: ${{ steps.create_release.outputs.upload_url }}
63+
asset_path: ./${{ env.zip-doc-build }}
64+
asset_name: ${{ env.zip-doc-build }}
65+
asset_content_type: application/zip
66+
67+
- name: Update changelog
68+
uses: thomaseizinger/keep-a-changelog-new-release@v1
69+
with:
70+
version: v${{ steps.tag.outputs.date }}
71+
72+
- name: Commit changelog
73+
run: |
74+
git config user.name "GitHub actions"
75+
git config user.email [email protected]
76+
git add CHANGELOG.md
77+
git commit --message "Updating Changelog"
78+
echo "::set-output name=commit::$(git rev-parse HEAD)"
79+
git push
2580
2681
- name: Deploy external documentation
2782
uses: peaceiris/[email protected]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Changelog Enforcer
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
5+
6+
jobs:
7+
# Enforces the update of a changelog file on every pull request
8+
changelog:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Accessing github project files
12+
uses: actions/checkout@v2
13+
14+
- uses: dangoslen/changelog-enforcer@v2
15+
with:
16+
changeLogPath: 'CHANGELOG.md'
17+
skipLabels: 'Skip-Changelog'

CHANGELOG.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
24
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
35
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
46

5-
## Documentation Update <sub><sup>(February 16, 2021)</sup></sub>
6-
### Changed
7-
* Added documentation for two <a href="https://dealerdotcom.github.io/web-integration-api-docs/#insert-locations">Insert Locations</a>.
8-
* <a href="https://dealerdotcom.github.io/web-integration-api-docs/#content">`content`</a> requires that a landing page be created with this target.
9-
* <a href="https://dealerdotcom.github.io/web-integration-api-docs/#secondary-content">`secondary-content`</a> is present ~2/3 of the way down on details pages.
10-
11-
## Documentation Update <sub><sup>(February 5, 2021)</sup></sub>
12-
### Changed
13-
* Updated code examples to use modern practices.
14-
* `var` has been replaced with `const` or `let`, and all functions have been replaced by arrow functions.
15-
16-
## 1.2.33 <sub><sup>(January 27, 2021)</sup></sub>
7+
## [Unreleased]
178
### Added
18-
* Added `digital-retailing` location for placement of Digital Retailing integration content, such as an iframe.
9+
* Added a changelog enforcer to the workflow.
10+
* Tagging and uploading the releases.
11+
* Updating the changelog after a release

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY .github/build.sh /usr/src/bin/
66

77
RUN gem install bundler
88

9-
RUN apk --no-cache --update add nodejs g++ make coreutils git && \
9+
RUN apk --no-cache --update add nodejs g++ make coreutils git zip && \
1010
git clone https://github.com/slatedocs/slate.git /usr/src/app && \
1111
bundle install && \
1212
chmod +x /usr/src/bin/*.sh

0 commit comments

Comments
 (0)