Skip to content

Commit 4421827

Browse files
JamesIvesPike
andauthored
[Release] Version 4 (JamesIves#589)
* Stop checking out workspace (JamesIves#515) * Stop checking out base branch before deployment, drop option. * Don't check out default branch, as we don't check out base branch, drop option. * Don't stash/unstash as we don't update the workdir, drop preserve option. * Don't init the workspace * Only fetch the remote branch if it exists, only with depth 1. * Rely on previous checkouts to have handled lfs files correctly, drop option. * Update README, action.yml, integration tests * Set up eslint for test files. (JamesIves#517) * Add DRY_RUN option, passing --dry-run to git push. (JamesIves#526) See JamesIves#499 for the proposal. * Simplifies Token Setup (JamesIves#530) * Token simplification * Access Token / Github Token -> Token * Oops * Typos * Update README.md * Update README.md * Update action.yml Co-authored-by: Axel Hecht <axel@pike.org> * Update README.md Co-authored-by: Axel Hecht <axel@pike.org> * Update README.md Co-authored-by: Axel Hecht <axel@pike.org> * Adjust codeql action to latest recommendations (JamesIves#540) Also, add the dev and release branches, and drop master. * Add workflow to update build and node_modules on release branches (JamesIves#541) * Stores username/email in secrets * Removing stale bot integration * Test current code base as an integration test for PRs and pushes (JamesIves#505) * Add a build step to create lib and node_modules artifact * Run integration test with built dist and current SHA as base For pull requests, the github.sha is the sha of the merge to the target branch, not the head of the PR. Special case that. * Use v2 checkout, and DRY_RUN for the integration test. I also made the branches more generic, as there are now more of them. * Fix JamesIves#536, don't push at all on dryRun Also add tests for dryRun and singleCommit and generateBranch code flows. * Try to fix dryRun on new remote branches, refactor fetch * Try to fix dryRun, only fetch if origin branch exists * Refactor worktree setup to include branch generation and setup for singleCommit This is a continuation of the no-checkout work, and sadly suggested pretty intensive changes. * Set up git config to fix tests, also make debugging easier * Add matrix for existing and non-existing branch * Add matrix for singleCommit and not * Drop GITHUB_TOKEN, add DRY_RUN to action.yml * When deploying existing branch, add a modifcation and deploy again * Force branch checkout to work in redeployment scenarios * Make singleCommit easier to see in job descriptions * Review comments * Add a test-only property to action to test code paths with remote branch. * Introduce TestFlag enum to signal different test scenarios to unit tests * Fix util.test.ts * Update worktree.ts * Fix a few nits in tests and automation. Don't try to wordcount ls-rem… (JamesIves#546) * Fix a few nits in tests and automation. Don't try to wordcount ls-remote. Nits in tests are around undoing changes made to the environment, and to not modify the checkout. * Describe suite with empty SHA * Lowercase Inputs (JamesIves#547) * Lowercases inputs * Adjusts workflow tests and deployment_status * Use multi-line string for clean-exclude patterns. (JamesIves#553) As this change is subtle, I'm taking the opportunity to change the underscore for the hyphen, which makes it less likely that users of this action will just pass in an old json array. * Hyphenate inputs and outputs, add step output, fix JamesIves#558 (JamesIves#559) * Hyphenate inputs and outputs, add step output, fix JamesIves#558 I've also tried to make the clean docs a bit clearer, and consistent about clean being on my default. Still not totally happy with the intro of the docs there, though. * Add testing of step outputs to build integration tests * Security Docs * Integration tests * Revert "Integration tests" This reverts commit 639ff53. * Native SSH Key Support (JamesIves#569) * SSH Key Support 🔑 * Update ssh.ts * Update src/ssh.ts Co-authored-by: Axel Hecht <axel@pike.org> * README fixes/etc * Unit Tests & README * ssh key * Update README.md * Update ssh.test.ts * Update ssh.test.ts * Update ssh.test.ts * Update ssh.test.ts * Update ssh.test.ts * Update ssh.test.ts * Update integration.yml Co-authored-by: Axel Hecht <axel@pike.org> * Deployment Issues (JamesIves#583) * Update git.ts * Tests * Update git.ts * Formatting * Update src/git.ts Co-authored-by: Axel Hecht <axel@pike.org> * TestFlag * Logging * Update git.ts Co-authored-by: Axel Hecht <axel@pike.org> * Codespace Support (JamesIves#584) * Add files via upload * Update README.md * Add files via upload * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * SSH Issues (JamesIves#588) * Unsets Persisted Credentials (JamesIves#587) * Persist * Config Setup/Tests * Assets * Update git.ts * Spacing * Update integration.yml * Update README.md Co-authored-by: Axel Hecht <axel@pike.org>
1 parent 023cc8d commit 4421827

32 files changed

+1294
-938
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ARG VARIANT=12
2+
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:${VARIANT}

.devcontainer/base.Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG VARIANT=12-buster
2+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:dev-${VARIANT}
3+
4+
# Install tslint, typescript. eslint is installed by javascript image
5+
ARG NODE_MODULES="tslint-to-eslint-config typescript"
6+
RUN su node -c "umask 0002 && npm install -g ${NODE_MODULES}" \
7+
&& npm cache clean --force > /dev/null 2>&1

.devcontainer/devcontainer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/typescript-node
2+
{
3+
"name": "Node.js & TypeScript",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
// Update 'VARIANT' to pick a Node version: 10, 12, 14
7+
"args": {
8+
"VARIANT": "14"
9+
}
10+
},
11+
"settings": {
12+
"terminal.integrated.shell.linux": "/bin/bash"
13+
},
14+
"extensions": [
15+
"dbaeumer.vscode-eslint"
16+
],
17+
"remoteUser": "node"
18+
}

.eslintrc.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"parserOptions": {
66
"ecmaVersion": 9,
77
"sourceType": "module",
8-
"project": "./tsconfig.json"
8+
"project": "./tsconfig.lint.json"
99
},
1010
"globals": {
1111
"fetch": true
@@ -55,8 +55,9 @@
5555
"@typescript-eslint/type-annotation-spacing": "error",
5656
"@typescript-eslint/unbound-method": "error",
5757
"no-console": "off",
58-
"no-shadow": ["error", { "builtinGlobals": false, "hoist": "all", "allow": ["Status"] }]
59-
},
58+
"no-shadow": "off", // replaced by ts-eslint rule below
59+
"@typescript-eslint/no-shadow": "error"
60+
},
6061
"env": {
6162
"node": true,
6263
"es6": true,

.github/ISSUE_TEMPLATE/BUG_REPORT.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ labels:
88

99
<!-- Please check the Q&A before posting an issue: https://github.com/JamesIves/github-pages-deploy-action/discussions?discussions_q=category%3AQ%26A -->
1010

11-
**Describe the bug**
11+
### Describe the bug
1212
<!-- Please provide a clear and concise description of what the bug is. -->
1313

14-
**Reproduce**
14+
---
15+
16+
### Reproduction Steps
1517
<!-- Steps to reproduce the behavior. -->
1618

17-
**Logs**
19+
---
20+
21+
### Logs
1822
<!-- Please provide your deployment logs and a link or sample to/of your workflow. If the error message isn't revealing the problem please set ACTIONS_STEP_DEBUG to true in your repository's secrets menu and run the workflow again. -->
1923

20-
**Additional Comments**
24+
---
25+
26+
### Additional Comments
2127
<!--Add any other context about the problem here. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
**Description**
2-
> Provide a description of what your changes do.
1+
### Description
2+
<!-- Provide a description of what your changes do. -->
33

4-
**Testing Instructions**
5-
> Give us step by step instructions on how to test your changes.
4+
---
65

7-
**Additional Notes**
8-
> Anything else that will help us test the pull request.
6+
### Testing Instructions
7+
<!-- Give us step by step instructions on how to test your changes. -->
8+
9+
---
10+
11+
### Additional Notes
12+
<!-- Anything else that will help us test the pull request. -->

.github/stale.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 101 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ name: unit-tests
22
on:
33
pull_request:
44
branches:
5-
- dev
6-
- releases/v3
5+
- 'dev*'
6+
- 'releases/v*'
77
push:
88
branches:
9-
- dev
9+
- 'dev*'
1010
tags-ignore:
1111
- '*.*'
1212
jobs:
1313
unit-tests:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v1
17+
uses: actions/checkout@v2
1818

1919
- uses: actions/setup-node@v1.4.4
2020
with:
21-
node-version: '10.15.1'
21+
node-version: 'v12.18.4'
2222
registry-url: 'https://registry.npmjs.org'
2323

2424
- name: Install Yarn
@@ -34,3 +34,99 @@ jobs:
3434
uses: codecov/codecov-action@v1
3535
with:
3636
token: ${{ secrets.CODECOV_TOKEN }}
37+
38+
build:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
44+
- uses: actions/setup-node@v1.4.4
45+
with:
46+
node-version: 'v12.18.4'
47+
registry-url: 'https://registry.npmjs.org'
48+
49+
- name: Install Yarn
50+
run: npm install -g yarn
51+
52+
- name: Build lib
53+
run: |
54+
yarn install
55+
yarn build
56+
57+
- name: Rebuild production node_modules
58+
run: |
59+
yarn install --production
60+
ls node_modules
61+
62+
- name: artifact
63+
uses: actions/upload-artifact@v2
64+
with:
65+
name: dist
66+
path: |
67+
lib
68+
node_modules
69+
70+
integration:
71+
runs-on: ubuntu-latest
72+
needs: build
73+
strategy:
74+
matrix:
75+
branch: ["gh-pages", "no-pages"]
76+
commit: ["singleCommit", "add commits"]
77+
steps:
78+
- name: Checkout
79+
uses: actions/checkout@v2
80+
with:
81+
persist-credentials: false
82+
83+
- uses: actions/setup-node@v1.4.4
84+
with:
85+
node-version: 'v12.18.4'
86+
registry-url: 'https://registry.npmjs.org'
87+
88+
- name: Download artifact
89+
uses: actions/download-artifact@v2
90+
with:
91+
name: dist
92+
93+
- name: Deploy
94+
id: unmodified
95+
uses: ./
96+
with:
97+
folder: integration
98+
branch: ${{ matrix.branch }}
99+
single-commit: ${{ matrix.commit == 'singleCommit' }}
100+
dry-run: true
101+
102+
# Usually, this should be skipped, but if the upstream gh-pages
103+
# branch doesn't match ours, it should still be a success.
104+
- name: Check step output
105+
run: |
106+
[[ \
107+
${{steps.unmodified.outputs.deployment-status}} = skipped || \
108+
${{steps.unmodified.outputs.deployment-status}} = success \
109+
]]
110+
111+
- name: Tweak content to publish to existing branch
112+
if: ${{ matrix.branch == 'gh-pages' }}
113+
run: |
114+
echo "<!-- just sayin -->" >> integration/index.html
115+
116+
- name: Deploy with modifications to existing branch
117+
id: modified
118+
uses: ./
119+
if: ${{ matrix.branch == 'gh-pages' }}
120+
with:
121+
folder: integration
122+
branch: ${{ matrix.branch }}
123+
single-commit: ${{ matrix.commit == 'singleCommit' }}
124+
dry-run: true
125+
126+
# The modified deployment should be a success, and not skipped.
127+
- name: Check step output
128+
if: ${{ matrix.branch == 'gh-pages' }}
129+
run: |
130+
[[ \
131+
${{steps.modified.outputs.deployment-status}} = success \
132+
]]

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: "CodeQL"
2-
32
on:
43
push:
5-
branches: [dev, master, releases/v2, releases/v3]
4+
branches:
5+
- dev
6+
- 'dev-v*'
7+
- 'releases/v*'
68
pull_request:
79
# The branches below must be a subset of the branches above
8-
branches: [dev]
10+
branches:
11+
- dev
12+
- 'dev-v*'
913
schedule:
1014
- cron: '0 9 * * 4'
1115

@@ -17,15 +21,6 @@ jobs:
1721
steps:
1822
- name: Checkout repository
1923
uses: actions/checkout@v2
20-
with:
21-
# We must fetch at least the immediate parents so that if this is
22-
# a pull request then we can checkout the head.
23-
fetch-depth: 2
24-
25-
# If this run was triggered by a pull request event, then checkout
26-
# the head of the pull request instead of the merge commit.
27-
- run: git checkout HEAD^2
28-
if: ${{ github.event_name == 'pull_request' }}
2924

3025
# Initializes the CodeQL tools for scanning.
3126
- name: Initialize CodeQL

0 commit comments

Comments
 (0)