2020-03-28 22:35:26 +08:00
|
|
|
import {info} from '@actions/core'
|
2020-07-14 00:52:45 +08:00
|
|
|
import {mkdirP, rmRF} from '@actions/io'
|
|
|
|
import fs from 'fs'
|
2022-01-06 22:50:18 +08:00
|
|
|
import {
|
|
|
|
ActionInterface,
|
|
|
|
DefaultExcludedFiles,
|
|
|
|
Status,
|
|
|
|
TestFlag
|
|
|
|
} from './constants'
|
2020-03-05 21:19:45 +08:00
|
|
|
import {execute} from './execute'
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
import {generateWorktree} from './worktree'
|
2021-10-07 06:20:55 +08:00
|
|
|
import {
|
|
|
|
extractErrorMessage,
|
|
|
|
isNullOrUndefined,
|
|
|
|
suppressSensitiveInformation
|
|
|
|
} from './util'
|
2019-11-19 23:06:27 +08:00
|
|
|
|
2020-03-02 22:05:39 +08:00
|
|
|
/* Initializes git in the workspace. */
|
2020-03-07 11:36:56 +08:00
|
|
|
export async function init(action: ActionInterface): Promise<void | Error> {
|
2019-11-19 23:06:27 +08:00
|
|
|
try {
|
2020-03-28 23:33:51 +08:00
|
|
|
info(`Deploying using ${action.tokenType}… 🔑`)
|
|
|
|
info('Configuring git…')
|
2020-01-20 04:33:14 +08:00
|
|
|
|
2020-06-26 20:18:23 +08:00
|
|
|
await execute(
|
|
|
|
`git config user.name "${action.name}"`,
|
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
2022-01-06 22:50:18 +08:00
|
|
|
|
2020-06-26 20:18:23 +08:00
|
|
|
await execute(
|
2021-11-26 20:46:44 +08:00
|
|
|
`git config user.email "${action.email}"`,
|
2020-06-26 20:18:23 +08:00
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
2020-07-05 02:38:32 +08:00
|
|
|
|
2022-01-06 22:50:18 +08:00
|
|
|
await execute(
|
|
|
|
`git config core.ignorecase false`,
|
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
|
|
|
|
2020-09-28 02:37:43 +08:00
|
|
|
try {
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
if ((process.env.CI && !action.sshKey) || action.isTest) {
|
|
|
|
/* Ensures that previously set Git configs do not interfere with the deployment.
|
|
|
|
Only runs in the GitHub Actions CI environment if a user is not using an SSH key.
|
|
|
|
*/
|
|
|
|
await execute(
|
2021-03-04 21:47:44 +08:00
|
|
|
`git config --local --unset-all http.https://${action.hostname}/.extraheader`,
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
|
|
|
}
|
2020-09-28 02:54:34 +08:00
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
if (action.isTest === TestFlag.UNABLE_TO_UNSET_GIT_CONFIG) {
|
2020-09-28 02:54:34 +08:00
|
|
|
throw new Error()
|
2020-09-28 02:37:43 +08:00
|
|
|
}
|
2020-09-28 02:54:34 +08:00
|
|
|
} catch {
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
info(
|
|
|
|
'Unable to unset previous git config authentication as it may not exist, continuing…'
|
|
|
|
)
|
2020-09-28 02:37:43 +08:00
|
|
|
}
|
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
try {
|
|
|
|
await execute(`git remote rm origin`, action.workspace, action.silent)
|
2020-09-28 02:37:43 +08:00
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
if (action.isTest === TestFlag.UNABLE_TO_REMOVE_ORIGIN) {
|
|
|
|
throw new Error()
|
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
info('Attempted to remove origin but failed, continuing…')
|
2020-09-28 02:37:43 +08:00
|
|
|
}
|
|
|
|
|
2020-06-26 20:18:23 +08:00
|
|
|
await execute(
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
`git remote add origin ${action.repositoryPath}`,
|
2020-06-26 20:18:23 +08:00
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
2020-03-28 23:33:51 +08:00
|
|
|
info('Git configured… 🔧')
|
2019-11-19 23:06:27 +08:00
|
|
|
} catch (error) {
|
2020-03-02 20:52:38 +08:00
|
|
|
throw new Error(
|
2020-07-05 02:47:45 +08:00
|
|
|
`There was an error initializing the repository: ${suppressSensitiveInformation(
|
2021-10-07 06:20:55 +08:00
|
|
|
extractErrorMessage(error),
|
2020-03-02 20:52:38 +08:00
|
|
|
action
|
|
|
|
)} ❌`
|
2020-03-05 21:19:45 +08:00
|
|
|
)
|
2019-11-19 23:06:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 20:52:38 +08:00
|
|
|
/* Runs the necessary steps to make the deployment. */
|
2020-05-15 05:24:32 +08:00
|
|
|
export async function deploy(action: ActionInterface): Promise<Status> {
|
2020-05-25 00:50:10 +08:00
|
|
|
const temporaryDeploymentDirectory =
|
|
|
|
'github-pages-deploy-action-temp-deployment-folder'
|
2020-05-25 00:49:54 +08:00
|
|
|
const temporaryDeploymentBranch = `github-pages-deploy-action/${Math.random()
|
|
|
|
.toString(36)
|
|
|
|
.substr(2, 9)}`
|
2020-03-31 08:44:09 +08:00
|
|
|
|
2020-03-28 23:33:51 +08:00
|
|
|
info('Starting to commit changes…')
|
2019-11-19 23:06:27 +08:00
|
|
|
|
2020-03-02 20:52:38 +08:00
|
|
|
try {
|
2020-04-04 20:23:43 +08:00
|
|
|
const commitMessage = !isNullOrUndefined(action.commitMessage)
|
|
|
|
? (action.commitMessage as string)
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
: `Deploying to ${action.branch}${
|
|
|
|
process.env.GITHUB_SHA
|
|
|
|
? ` from @ ${process.env.GITHUB_REPOSITORY}@${process.env.GITHUB_SHA}`
|
|
|
|
: ''
|
2020-04-04 20:23:43 +08:00
|
|
|
} 🚀`
|
2020-03-31 08:44:09 +08:00
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
// Checks to see if the remote exists prior to deploying.
|
|
|
|
const branchExists =
|
|
|
|
action.isTest & TestFlag.HAS_REMOTE_BRANCH ||
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
Boolean(
|
|
|
|
(
|
|
|
|
await execute(
|
|
|
|
`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`,
|
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
|
|
|
).stdout
|
|
|
|
)
|
2020-09-28 02:37:43 +08:00
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
await generateWorktree(action, temporaryDeploymentDirectory, branchExists)
|
2020-03-02 20:52:38 +08:00
|
|
|
|
|
|
|
// Ensures that items that need to be excluded from the clean job get parsed.
|
2020-03-05 21:19:45 +08:00
|
|
|
let excludes = ''
|
2020-03-02 20:52:38 +08:00
|
|
|
if (action.clean && action.cleanExclude) {
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
for (const item of action.cleanExclude) {
|
|
|
|
excludes += `--exclude ${item} `
|
2020-03-02 20:52:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-30 20:29:24 +08:00
|
|
|
if (action.targetFolder) {
|
|
|
|
info(`Creating target folder if it doesn't already exist… 📌`)
|
|
|
|
await mkdirP(`${temporaryDeploymentDirectory}/${action.targetFolder}`)
|
|
|
|
}
|
|
|
|
|
2020-03-02 20:52:38 +08:00
|
|
|
/*
|
|
|
|
Pushes all of the build files into the deployment directory.
|
|
|
|
Allows the user to specify the root if '.' is provided.
|
|
|
|
rsync is used to prevent file duplication. */
|
|
|
|
await execute(
|
2020-10-15 22:20:15 +08:00
|
|
|
`rsync -q -av --checksum --progress ${action.folderPath}/. ${
|
2020-03-02 20:52:38 +08:00
|
|
|
action.targetFolder
|
|
|
|
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
|
|
|
|
: temporaryDeploymentDirectory
|
|
|
|
} ${
|
|
|
|
action.clean
|
2020-07-14 00:52:45 +08:00
|
|
|
? `--delete ${excludes} ${
|
2022-01-06 22:50:18 +08:00
|
|
|
!fs.existsSync(
|
|
|
|
`${action.folderPath}/${DefaultExcludedFiles.CNAME}`
|
|
|
|
)
|
|
|
|
? `--exclude ${DefaultExcludedFiles.CNAME}`
|
2020-10-15 22:20:15 +08:00
|
|
|
: ''
|
2020-07-14 00:52:45 +08:00
|
|
|
} ${
|
2022-01-06 22:50:18 +08:00
|
|
|
!fs.existsSync(
|
|
|
|
`${action.folderPath}/${DefaultExcludedFiles.NOJEKYLL}`
|
|
|
|
)
|
|
|
|
? `--exclude ${DefaultExcludedFiles.NOJEKYLL}`
|
2020-07-14 00:52:45 +08:00
|
|
|
: ''
|
|
|
|
}`
|
2020-03-05 21:19:45 +08:00
|
|
|
: ''
|
2022-01-06 22:50:18 +08:00
|
|
|
} --exclude ${DefaultExcludedFiles.SSH} --exclude ${
|
|
|
|
DefaultExcludedFiles.GIT
|
|
|
|
} --exclude ${DefaultExcludedFiles.GITHUB} ${
|
2020-10-15 22:20:15 +08:00
|
|
|
action.folderPath === action.workspace
|
2020-03-02 20:52:38 +08:00
|
|
|
? `--exclude ${temporaryDeploymentDirectory}`
|
2020-03-05 21:19:45 +08:00
|
|
|
: ''
|
2020-03-02 20:52:38 +08:00
|
|
|
}`,
|
2020-06-26 20:18:23 +08:00
|
|
|
action.workspace,
|
|
|
|
action.silent
|
2020-03-05 21:19:45 +08:00
|
|
|
)
|
2019-11-20 07:07:27 +08:00
|
|
|
|
2021-08-26 11:16:13 +08:00
|
|
|
if (action.singleCommit) {
|
|
|
|
await execute(
|
|
|
|
`git add --all .`,
|
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
// Use git status to check if we have something to commit.
|
|
|
|
// Special case is singleCommit with existing history, when
|
|
|
|
// we're really interested if the diff against the upstream branch
|
|
|
|
// changed.
|
|
|
|
const checkGitStatus =
|
|
|
|
branchExists && action.singleCommit
|
|
|
|
? `git diff origin/${action.branch}`
|
|
|
|
: `git status --porcelain`
|
2021-05-10 21:17:42 +08:00
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
info(`Checking if there are files to commit…`)
|
2021-05-10 21:17:42 +08:00
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
const hasFilesToCommit =
|
|
|
|
action.isTest & TestFlag.HAS_CHANGED_FILES ||
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
Boolean(
|
|
|
|
(
|
|
|
|
await execute(
|
|
|
|
checkGitStatus,
|
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
true // This output is always silenced due to the large output it creates.
|
|
|
|
)
|
|
|
|
).stdout
|
|
|
|
)
|
2020-03-02 20:52:38 +08:00
|
|
|
|
2021-05-10 21:17:42 +08:00
|
|
|
if (
|
|
|
|
(!action.singleCommit && !hasFilesToCommit) ||
|
|
|
|
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
|
|
|
|
(action.singleCommit && !action.targetFolder && !hasFilesToCommit)
|
|
|
|
) {
|
2020-05-15 05:24:32 +08:00
|
|
|
return Status.SKIPPED
|
2020-03-02 20:52:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Commits to GitHub.
|
|
|
|
await execute(
|
|
|
|
`git add --all .`,
|
2020-06-26 20:18:23 +08:00
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
2020-03-05 21:19:45 +08:00
|
|
|
)
|
2020-03-02 20:52:38 +08:00
|
|
|
await execute(
|
|
|
|
`git checkout -b ${temporaryDeploymentBranch}`,
|
2020-06-26 20:18:23 +08:00
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
2020-03-05 21:19:45 +08:00
|
|
|
)
|
2020-03-02 20:52:38 +08:00
|
|
|
await execute(
|
2020-07-27 22:29:27 +08:00
|
|
|
`git commit -m "${commitMessage}" --quiet --no-verify`,
|
2020-06-26 20:18:23 +08:00
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
2020-03-05 21:19:45 +08:00
|
|
|
)
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
|
|
|
|
if (action.dryRun) {
|
|
|
|
info(`Dry run complete`)
|
|
|
|
return Status.SUCCESS
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.force) {
|
|
|
|
// Force-push our changes, overwriting any changes that were added in
|
|
|
|
// the meantime
|
|
|
|
info(`Force-pushing changes...`)
|
2020-03-31 08:44:09 +08:00
|
|
|
await execute(
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`,
|
2020-06-26 20:18:23 +08:00
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
2020-03-31 08:44:09 +08:00
|
|
|
)
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
} else {
|
2022-04-04 21:17:40 +08:00
|
|
|
const ATTEMPT_LIMIT = 3
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
// Attempt to push our changes, but fetch + rebase if there were
|
|
|
|
// other changes added in the meantime
|
|
|
|
let attempt = 0
|
2022-04-04 21:17:40 +08:00
|
|
|
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
// Keep track of whether the most recent attempt was rejected
|
|
|
|
let rejected = false
|
2022-04-04 21:17:40 +08:00
|
|
|
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
do {
|
|
|
|
attempt++
|
2022-04-04 21:17:40 +08:00
|
|
|
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
if (attempt > ATTEMPT_LIMIT) throw new Error(`Attempt limit exceeded`)
|
|
|
|
|
|
|
|
// Handle rejection for the previous attempt first such that, on
|
|
|
|
// the final attempt, time is not wasted rebasing it when it will
|
|
|
|
// not be pushed
|
|
|
|
if (rejected) {
|
2022-04-04 21:17:40 +08:00
|
|
|
info(`Fetching upstream ${action.branch}…`)
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
await execute(
|
|
|
|
`git fetch ${action.repositoryPath} ${action.branch}:${action.branch}`,
|
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
|
|
|
)
|
2022-04-04 21:17:40 +08:00
|
|
|
info(`Rebasing this deployment onto ${action.branch}…`)
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
await execute(
|
|
|
|
`git rebase ${action.branch} ${temporaryDeploymentBranch}`,
|
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-04-04 21:17:40 +08:00
|
|
|
info(`Pushing changes… (attempt ${attempt} of ${ATTEMPT_LIMIT})`)
|
|
|
|
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
const pushResult = await execute(
|
|
|
|
`git push --porcelain ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`,
|
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent,
|
|
|
|
true // Ignore non-zero exit status
|
|
|
|
)
|
|
|
|
|
|
|
|
rejected =
|
2022-04-04 21:17:40 +08:00
|
|
|
Boolean(action.isTest) ||
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
pushResult.stdout.includes(`[rejected]`) ||
|
|
|
|
pushResult.stdout.includes(`[remote rejected]`)
|
2022-04-04 21:17:40 +08:00
|
|
|
|
Resolve simultaneous deployments with rebase (#1054)
* Return early from dry run
Determining whether to create a merge commit would elicit a nested
conditional, which could be hard to parse for a human reader. This is
avoided by returning early as soon as possible for a dry run.
This also resolves the erroneous 'changes committed' message when no
changes were actually committed because of the dry run. A message
specific to dry-run is logged instead.
* Add force parameter to action interface
Existing behaviour is equivalent to force=true, so the default value is
true.
* Implement pull+rebase procedure
* Declare force parameter in action
* Detect both rejection syntaxes
* Return both stdout and stderr from execute
* Ignore non-zero exit status on push
* Remove unnecessary error catch
* Fetch and rebase in separate steps
* Explicitly bind incoming branch
I think the fetch will update the origin/gh-pages branch but not the
gh-pages branch, despite requesting gh-pages. This means that when I
later attempt to rebase the temp branch on top of the gh-pages branch,
there will be nothing to do, because that's already where it is.
* Implement attempt limit
I don't expect this to ever require more than one attempt in production,
but in theory it's possible that this procedure could loop forever.
We would need to keep fetching and rebasing if changes keep being added
to the remote. In practice, I believe this would only happen if there
are lots of workflows simultaneously deploying to the same branch, all
using this action. In this case only one would be able to secure a lock
at a time, leading to the total number of attempts being equal to the
number of simultaneous deployments, assuming each deployment makes each
attempt at the exact same time.
The limit may need to be increased or even be configurable, but 3 should
cover most uses.
* Update tests for execute output split
* Document 'force' parameter
* Create integration test for rebase procedure
This test is composed of 3 jobs.
The first two jobs run simultaneously, and as such both depend on the
previous integration test only. The final job cleans up afterwards, and
depends on both of the prior jobs.
The two jobs are identical except that they both create a temporary file
in a different location. This is to ensure that they conflict. Correctly
resolving this conflict by rebasing one deployment over the other,
resulting in a deployment containing both files, indicates a successful
test.
2022-04-04 19:18:27 +08:00
|
|
|
if (rejected) info('Updates were rejected')
|
|
|
|
|
|
|
|
// If the push failed for any reason other than being rejected,
|
|
|
|
// there is a problem
|
|
|
|
if (!rejected && pushResult.stderr) throw new Error(pushResult.stderr)
|
|
|
|
} while (rejected)
|
2020-03-31 08:44:09 +08:00
|
|
|
}
|
|
|
|
|
[Release] Version 4 (#589)
* Stop checking out workspace (#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. (#517)
* Add DRY_RUN option, passing --dry-run to git push. (#526)
See #499 for the proposal.
* Simplifies Token Setup (#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 (#540)
Also, add the dev and release branches, and drop master.
* Add workflow to update build and node_modules on release branches (#541)
* Stores username/email in secrets
* Removing stale bot integration
* Test current code base as an integration test for PRs and pushes (#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 #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… (#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 (#547)
* Lowercases inputs
* Adjusts workflow tests and deployment_status
* Use multi-line string for clean-exclude patterns. (#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 #558 (#559)
* Hyphenate inputs and outputs, add step output, fix #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 639ff537d5bf88b668efb3a56d361e2a03f008c9.
* Native SSH Key Support (#569)
* SSH Key Support :key:
* 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 (#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 (#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 (#588)
* Unsets Persisted Credentials (#587)
* Persist
* Config Setup/Tests
* Assets
* Update git.ts
* Spacing
* Update integration.yml
* Update README.md
Co-authored-by: Axel Hecht <axel@pike.org>
2021-02-06 11:05:18 +08:00
|
|
|
info(`Changes committed to the ${action.branch} branch… 📦`)
|
2020-05-15 05:24:32 +08:00
|
|
|
|
|
|
|
return Status.SUCCESS
|
2020-03-02 20:52:38 +08:00
|
|
|
} catch (error) {
|
|
|
|
throw new Error(
|
|
|
|
`The deploy step encountered an error: ${suppressSensitiveInformation(
|
2021-10-07 06:20:55 +08:00
|
|
|
extractErrorMessage(error),
|
2020-03-02 20:52:38 +08:00
|
|
|
action
|
|
|
|
)} ❌`
|
2020-03-05 21:19:45 +08:00
|
|
|
)
|
2020-03-02 20:52:38 +08:00
|
|
|
} finally {
|
2020-05-24 23:18:06 +08:00
|
|
|
// Cleans up temporary files/folders and restores the git state.
|
|
|
|
info('Running post deployment cleanup jobs… 🗑️')
|
2021-05-10 21:17:42 +08:00
|
|
|
|
2021-05-12 07:03:39 +08:00
|
|
|
await execute(
|
|
|
|
`git checkout -B ${temporaryDeploymentBranch}`,
|
|
|
|
`${action.workspace}/${temporaryDeploymentDirectory}`,
|
|
|
|
action.silent
|
|
|
|
)
|
2021-05-10 21:17:42 +08:00
|
|
|
|
2021-11-18 20:49:23 +08:00
|
|
|
await execute(
|
|
|
|
`chmod -R 777 ${temporaryDeploymentDirectory}`,
|
|
|
|
action.workspace,
|
|
|
|
action.silent
|
|
|
|
)
|
|
|
|
|
2020-05-24 22:57:49 +08:00
|
|
|
await execute(
|
2020-05-24 23:24:33 +08:00
|
|
|
`git worktree remove ${temporaryDeploymentDirectory} --force`,
|
2020-06-26 20:18:23 +08:00
|
|
|
action.workspace,
|
|
|
|
action.silent
|
2020-05-24 22:57:49 +08:00
|
|
|
)
|
2021-05-10 21:17:42 +08:00
|
|
|
|
2020-04-12 01:57:56 +08:00
|
|
|
await rmRF(temporaryDeploymentDirectory)
|
2020-03-02 20:52:38 +08:00
|
|
|
}
|
2019-11-19 23:06:27 +08:00
|
|
|
}
|