Compare commits

...
6 Commits
Author SHA1 Message Date
Antoine BarthelemyandDmitry Kisler b06654f7ba update(doc): add version to avoid error when copy pasting examples (#8)
Co-authored-by: Dmitry Kisler <admin@dkisler.com>
2023-10-27 10:01:34 +01:00
Dmitry Kisler 6cdd07fc43 Add API token header to prevent side effects during tests (#16)
* feat: add API token header to prevent side effects during tests

Signed-off-by: Dmitry Kisler <admin@dkisler.com>
2023-10-26 21:29:12 +01:00
Antoine Barthelemy 5f01fa71eb feat(gha): Automated Release Workflow for GitHub Repositories (#10)
Signed-off-by: Antoine Barthelemy <antoine@linux.com>

---------

Signed-off-by: Antoine Barthelemy <antoine@linux.com>
2023-10-26 21:20:56 +01:00
Dmitry Kisler 8767493626 Fixes tests for release.js (#14) 2023-10-26 16:07:06 +01:00
dependabot[bot] abd9f2b70f chore(deps-dev): Bump nock from 13.3.3 to 13.3.6 (#12)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 15:43:01 +01:00
dependabot[bot] 595213afdb chore(deps-dev): Bump @vercel/ncc from 0.38.0 to 0.38.1 (#11)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 15:42:41 +01:00
9 changed files with 62 additions and 68 deletions

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
name: Retag
on:
push:
tags:
- 'v[1-2].[0-9]+.[0-9]+*'
defaults:
run:
shell: bash
jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
set -o pipefail
git tag --force "$(grep '^v[1-2]\.[0-9]\+\.[0-9]\+\(.*\)\?$' <<< ${GITHUB_REF#refs/*/} | sed 's/^v\([1-2]\)\..*/v\1/')"
git push --tag --force
+3 -1
View File
@@ -10,6 +10,9 @@ defaults:
run:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
tofu-versions:
name: 'OpenTofu Versions'
@@ -181,4 +184,3 @@ jobs:
if: runner.os != 'Windows'
run: |
[[ -f ${HOME}/.tofurc ]] || exit 0
-3
View File
@@ -1,3 +0,0 @@
## Unreleased
Initial release. It provides feature parity with the [setup-terraform](https://github.com/hashicorp/setup-terraform) action.
+8 -8
View File
@@ -22,14 +22,14 @@ The default configuration installs the latest version of OpenTofu CLI and instal
```yaml
steps:
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
```
A specific version of OpenTofu CLI can be installed:
```yaml
steps:
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.0-alpha1
```
@@ -38,7 +38,7 @@ Credentials for Terraform Cloud ([app.terraform.io](https://app.terraform.io/))
```yaml
steps:
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
```
@@ -47,7 +47,7 @@ Credentials for Terraform Enterprise (TFE) can be configured:
```yaml
steps:
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
with:
cli_config_credentials_hostname: 'tofu.example.com'
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
@@ -57,7 +57,7 @@ The wrapper script installation can be skipped by setting the `tofu_wrapper` var
```yaml
steps:
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
with:
tofu_wrapper: false
```
@@ -66,7 +66,7 @@ Subsequent steps can access outputs when the wrapper script is installed:
```yaml
steps:
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
- run: tofu init
@@ -94,7 +94,7 @@ permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
- name: OpenTofu fmt
id: fmt
@@ -162,7 +162,7 @@ permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: opentofu/setup-opentofu
- uses: opentofu/setup-opentofu@v1
- name: OpenTofu fmt
id: fmt
+10 -4
View File
@@ -36,11 +36,17 @@ class Release {
async function fetchReleases () {
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
const headers = {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28'
};
if (process.env.GITHUB_TOKEN) {
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
}
const resp = await fetch(url, {
headers: {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28'
}
headers
});
if (!resp.ok) {
+10 -4
View File
@@ -30,11 +30,17 @@ class Release {
async function fetchReleases () {
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
const headers = {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28'
};
if (process.env.GITHUB_TOKEN) {
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
}
const resp = await fetch(url, {
headers: {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28'
}
headers
});
if (!resp.ok) {
+2 -2
View File
@@ -203,8 +203,8 @@ describe('getRelease', () => {
it.each(
[
['foo', 'Input version cannot be used, see semver: https://semver.org/spec/v2.0.0.html', undefined],
['2.0', 'No matching version found', undefined],
['foo', 'Input version cannot be used, see semver: https://semver.org/spec/v2.0.0.html', mockFetchReleases],
['2.0', 'No matching version found', mockFetchReleases],
['latest', 'No tofu releases found, please contact OpenTofu', async () => { return null; }],
['latest', 'No tofu releases found, please contact OpenTofu', async () => { return []; }]
]
+6 -43
View File
@@ -1,12 +1,12 @@
{
"name": "setup-opentofu",
"version": "0.0.1",
"version": "1.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-opentofu",
"version": "0.0.1",
"version": "1.0.1",
"license": "MPL-2.0",
"dependencies": {
"@actions/core": "1.10.1",
@@ -16,10 +16,9 @@
"semver": "7.5.4"
},
"devDependencies": {
"@vercel/ncc": "0.38.0",
"@vercel/ncc": "0.38.1",
"husky": "8.0.3",
"jest": "29.7.0",
"nock": "13.3.3",
"semistandard": "17.0.0"
}
},
@@ -1397,9 +1396,9 @@
"dev": true
},
"node_modules/@vercel/ncc": {
"version": "0.38.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.0.tgz",
"integrity": "sha512-B4YKZMm/EqMptKSFyAq4q2SlgJe+VCmEH6Y8gf/E1pTlWbsUJpuH1ymik2Ex3aYO5mCWwV1kaSYHSQOT8+4vHA==",
"version": "0.38.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz",
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
@@ -4525,12 +4524,6 @@
"integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
"dev": true
},
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
"dev": true
},
"node_modules/json5": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
@@ -4663,12 +4656,6 @@
"node": ">=8"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -4781,21 +4768,6 @@
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
"dev": true
},
"node_modules/nock": {
"version": "13.3.3",
"resolved": "https://registry.npmjs.org/nock/-/nock-13.3.3.tgz",
"integrity": "sha512-z+KUlILy9SK/RjpeXDiDUEAq4T94ADPHE3qaRkf66mpEhzc/ytOMm3Bwdrbq6k1tMWkbdujiKim3G2tfQARuJw==",
"dev": true,
"dependencies": {
"debug": "^4.1.0",
"json-stringify-safe": "^5.0.1",
"lodash": "^4.17.21",
"propagate": "^2.0.0"
},
"engines": {
"node": ">= 10.13"
}
},
"node_modules/node-int64": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
@@ -5289,15 +5261,6 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true
},
"node_modules/propagate": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz",
"integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==",
"dev": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/punycode": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "setup-opentofu",
"version": "0.0.1",
"version": "1.0.1",
"description": "Setup OpenTofu CLI for GitHub Actions",
"license": "MPL-2.0",
"publisher": "OpenTofu",
@@ -26,10 +26,9 @@
"semver": "7.5.4"
},
"devDependencies": {
"@vercel/ncc": "0.38.0",
"@vercel/ncc": "0.38.1",
"husky": "8.0.3",
"jest": "29.7.0",
"nock": "13.3.3",
"semistandard": "17.0.0"
},
"semistandard": {