Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the internal action ref when releasing a new version #40

Merged
merged 4 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ on:

jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: ./.github/workflows/node-test.yaml
25 changes: 25 additions & 0 deletions .github/workflows/update-release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,41 @@ jobs:
with:
script: |

try {
await github.rest.git.deleteRef({
ref: `refs/tags/${{ steps.new-tag.outputs.major }}`,
owner: context.repo.owner,
repo: context.repo.repo
});
console.log(`Deleted tags/${{ steps.new-tag.outputs.major }}.`);
}
catch (e) {
console.log(`Failed to delete tags/${{ steps.new-tag.outputs.major }} - assuming it never existed.`, e);
}

await github.rest.git.createRef({
ref: `refs/tags/${{ steps.new-tag.outputs.major }}`,
sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo
});
console.log(`Created tags/${{ steps.new-tag.outputs.major }} at ${context.sha}.`);

try {
await github.rest.git.deleteRef({
ref: `refs/tags/${{ steps.new-tag.outputs.minor }}`,
owner: context.repo.owner,
repo: context.repo.repo
});
}
catch (e) {
console.log(`Failed to delete tags/${{ steps.new-tag.outputs.minor }} - assuming it never existed.`, e);
}

await github.rest.git.createRef({
ref: `refs/tags/${{ steps.new-tag.outputs.minor }}`,
sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo
});
console.log(`Created tags/${{ steps.new-tag.outputs.minor }} at ${context.sha}.`);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:

jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
upgrade-policy: lts # optional
```
Expand Down
20 changes: 10 additions & 10 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See also:
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
runs-on: ubuntu-latest, macos-latest
exclude: |
Expand Down Expand Up @@ -71,7 +71,7 @@ See also:
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
runs-on: ubuntu-latest, macos-latest
include: |
Expand Down Expand Up @@ -104,7 +104,7 @@ Note: this creates a temporary local [composite action](https://docs.github.com/
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
post-checkout-steps: |
- name: Download some library
Expand All @@ -124,7 +124,7 @@ Note: this creates a temporary local [composite action](https://docs.github.com/
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
post-install-steps: |
- name: Check dependencies for vulnerabilities
Expand All @@ -144,7 +144,7 @@ Note: this creates a temporary local [composite action](https://docs.github.com/
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
post-test-steps: |
- name: Coverage Report
Expand All @@ -163,23 +163,23 @@ See [Github actions documentation for `jobs.<job_id>.runs-on`](https://docs.gith
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
runs-on: ubuntu-latest, macos-latest
```

```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
runs-on: '["ubuntu-latest", "macos-latest"]'
```

```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
runs-on: |
- ubuntu-latest
Expand Down Expand Up @@ -211,7 +211,7 @@ Command to run instead of `npm test`.
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
with:
test-command: npm run coverage
```
Expand Down Expand Up @@ -264,7 +264,7 @@ The implementation of `test-secrets` is, generally, a workaround for the limitat
```yaml
jobs:
test:
uses: pkgjs/action/.github/workflows/node-test.yaml@main
uses: pkgjs/action/.github/workflows/node-test.yaml@v0
secrets:
test-secrets: |-
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"description": "Github Actions tooling for testing Node.js packages",
"scripts": {
"lint": "[ \"$NODE_LTS_LATEST\" != \"\" ] && [ \"$MATRIX_NODE_VERSION\" != \"$NODE_LTS_LATEST\" ] && echo 'Skipping linting' || npx -- eslint .github",
"test": "for PRIVATE_ACTION in .github/actions/*/; do cd ${INIT_CWD}/${PRIVATE_ACTION} && npm test || exit 1; done && cd ${INIT_CWD} && npm run lint"
"test": "for PRIVATE_ACTION in .github/actions/*/; do cd ${INIT_CWD}/${PRIVATE_ACTION} && npm test || exit 1; done && cd ${INIT_CWD} && npm run lint",
"version": "sed -i.bak \"s/\\(uses: pkgjs\\/action.*\\)\\(@.*\\)$/\\1@v$npm_package_version/g\" .github/workflows/node-test.yaml; rm .github/workflows/node-test.yaml.bak; git diff; git add .github/workflows/node-test.yaml"
},
"repository": {
"type": "git",
Expand Down