-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lau Skorstengaard
committed
Dec 9, 2021
1 parent
4cafb43
commit c5e7653
Showing
343 changed files
with
76,903 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Toitware | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# pkg-publish | ||
GitHub action for publishing a package | ||
|
||
## Setup | ||
To set up publishing for a package repository add the following to `./github/workflows/publish.yml`: | ||
``` | ||
name: Publish package | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
create-release: | ||
name: Create new release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Publish | ||
uses: toitlang/pkg-publish@v1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Toit pkg publish | ||
description: Publish a Toit package to the package registry | ||
author: Toitware APS | ||
inputs: | ||
tag: | ||
description: The tag to publish to. | ||
required: false | ||
repository: | ||
description: The repository with the package. | ||
required: false | ||
runs: | ||
using: 'node12' | ||
main: 'index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
const core = require('@actions/core'); | ||
const github = require('@actions/github'); | ||
const https = require('https') | ||
|
||
try { | ||
const input_options = { | ||
required: true, | ||
trimWhitespace: true, | ||
}; | ||
|
||
const owner = github.context.repo.owner; | ||
const repo = github.context.repo.repo; | ||
|
||
let tag = core.getInput('tag'); | ||
if (tag === "") { | ||
const ref = github.context.ref | ||
tag = ref.substr(ref.lastIndexOf('/') + 1) | ||
console.log(`No tag given, using '${tag}'.`); | ||
} | ||
|
||
let repository = core.getInput('repository'); | ||
if (repository === "") { | ||
const owner = github.context.repo.owner; | ||
const repo = github.context.repo.repo; | ||
repository = `${owner}/${repo}` | ||
console.log(`No repository given, using '${repository}'.`) | ||
} | ||
|
||
let request_call = new Promise((resolve, reject) => { | ||
const options = { | ||
hostname: 'pkg.toit.io', | ||
port: 443, | ||
path: `/api/v1/register/github.com/${repository}/version/${tag}`, | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Content-Length': 0 | ||
} | ||
} | ||
|
||
const req = https.request(options, res => { | ||
console.log(`statusCode: ${res.statusCode}`) | ||
|
||
res.on('error', error => { | ||
reject(error); | ||
}); | ||
resolve(res); | ||
}); | ||
|
||
req.on('error', error => { | ||
reject(error) | ||
}); | ||
|
||
req.end(); | ||
}); | ||
|
||
request_call.then((response) => { | ||
console.log(response); | ||
}).catch((error) => { | ||
console.log(error); | ||
core.setFailed(error.message); | ||
}); | ||
|
||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.