Skip to content

Commit 389e64f

Browse files
committed
Deploy to GitHub Pages from GitHub Actions
1 parent 19ed2a7 commit 389e64f

File tree

4 files changed

+37
-244
lines changed

4 files changed

+37
-244
lines changed

.github/workflows/CI.yml

+35-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,48 @@ name: CI
22

33
on:
44
push:
5-
branches: [source, ci-test]
5+
branches: [source]
66

77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: true
17+
918
jobs:
1019
build:
1120
runs-on: ubuntu-latest
12-
1321
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-node@v3
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Setup Node
25+
uses: actions/setup-node@v3
1626
with:
1727
node-version: 8
1828
cache: yarn
19-
- run: yarn
20-
- run: yarn deploy
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v2
31+
- name: Install dependencies
32+
run: yarn
33+
- name: Build with DocPad
34+
run: yarn deploy
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v1
37+
with:
38+
path: out
39+
40+
deploy:
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
runs-on: ubuntu-latest
45+
needs: build
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v1

Gruntfile.js

-47
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = function (grunt) {
33

44
grunt.loadNpmTasks('grunt-contrib-clean');
55
grunt.loadNpmTasks('grunt-contrib-copy');
6-
grunt.loadNpmTasks('grunt-gh-pages');
76

87
grunt.loadTasks('./tasks');
98

@@ -20,30 +19,6 @@ module.exports = function (grunt) {
2019
dest: 'out/'
2120
}
2221
},
23-
'gh-pages': {
24-
options: {
25-
base: 'out',
26-
branch: 'master'
27-
},
28-
publish: {
29-
options: {
30-
repo: 'https://github.com/DefinitelyTyped/definitelytyped.github.io.git',
31-
message: 'publish (cli)'
32-
},
33-
src: ['**']
34-
},
35-
deploy: {
36-
options: {
37-
repo: 'https://' + process.env.GITHUB_TOKEN + '@github.com/' + process.env.GITHUB_REPOSITORY + '.git',
38-
message: 'publish (auto)',
39-
user: {
40-
name: 'dt-bot',
41-
42-
}
43-
},
44-
src: ['**']
45-
}
46-
},
4722
docpad: {
4823
options: require('./docpad'),
4924
generate: {
@@ -61,18 +36,6 @@ module.exports = function (grunt) {
6136
}
6237
});
6338

64-
grunt.registerTask('check-deploy', function() {
65-
this.requires(['build']);
66-
67-
if (process.env.GITHUB_ACTIONS === 'true' && process.env.GITHUB_REF === 'refs/heads/source') {
68-
grunt.log.writeln('executing deployment');
69-
grunt.task.run('gh-pages:deploy');
70-
}
71-
else {
72-
grunt.log.writeln('skipping deployment');
73-
}
74-
});
75-
7639
//
7740
grunt.registerTask('prep', 'Clean and prepare.', [
7841
'clean:out',
@@ -95,15 +58,5 @@ module.exports = function (grunt) {
9558
'copy:rootfiles'
9659
]);
9760

98-
grunt.registerTask('publish', 'Build and push to master using CLI.', [
99-
'build',
100-
'gh-pages:publish'
101-
]);
102-
103-
grunt.registerTask('deploy', 'Build with production env for bot.', [
104-
'build',
105-
'check-deploy'
106-
]);
107-
10861
grunt.registerTask('default', ['build']);
10962
};

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"docpad-plugin-livereload": "^2.6.0",
3939
"grunt": "^1.0.1",
4040
"grunt-cli": "^1.2.0",
41-
"grunt-gh-pages": "^2.0.0",
4241
"grunt-contrib-clean": "^1.1.0",
4342
"grunt-contrib-copy": "^1.0.0",
4443
"highlight.js": "^9.12.0",

0 commit comments

Comments
 (0)