Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-pico
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-pico
Commits
9c95c4d7
Unverified
Commit
9c95c4d7
authored
May 28, 2021
by
Earle F. Philhower, III
Committed by
GitHub
May 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI to update JSON when releases are published (#178)
parent
7e0eefe8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
3 deletions
+52
-3
.github/workflows/release-to-publish.yml
.github/workflows/release-to-publish.yml
+26
-0
.github/workflows/tag-to-draft-release.yml
.github/workflows/tag-to-draft-release.yml
+1
-1
package/update_release.py
package/update_release.py
+25
-0
package/upload_release.py
package/upload_release.py
+0
-2
No files found.
.github/workflows/release-to-publish.yml
0 → 100644
View file @
9c95c4d7
name
:
Arduino-Pico Release Publisher
on
:
release
:
types
:
[
published
]
jobs
:
package
:
name
:
Update master JSON file
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
with
:
submodules
:
true
-
uses
:
actions/setup-python@v2
with
:
python-version
:
'
3.x'
-
name
:
Deploy updated JSON
env
:
TRAVIS_BUILD_DIR
:
${{ github.workspace }}
BUILD_TYPE
:
package
CI_GITHUB_API_KEY
:
${{ secrets.GITHUB_TOKEN }}
run
:
|
TAG=$(git describe --exact-match --tags)
curl -L -o ./package_rp2040_index.json "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/$TAG/package_rp2040_index.json"
./package/update_release.py --token ${CI_GITHUB_API_KEY} --repo "$GITHUB_REPOSITORY" --tag global ./package_rp2040_index.json
.github/workflows/tag-to-draft-release.yml
View file @
9c95c4d7
...
...
@@ -38,4 +38,4 @@ jobs:
log=$(find ./package/versions -name package_rp2040_index.log)
zip=$(find ./package/versions -name rp2040*zip)
tag=$(find ./package/versions -name package_rp2040_index.tag -exec cat \{\} \;)
python3 ./package/upload_release.py --
user "$GITHUB_ACTOR" --
repo "$GITHUB_REPOSITORY" --token "$CI_GITHUB_API_KEY" --tag "$tag" --name "Release $tag" --msg "@$log" "$zip" "$json"
python3 ./package/upload_release.py --repo "$GITHUB_REPOSITORY" --token "$CI_GITHUB_API_KEY" --tag "$tag" --name "Release $tag" --msg "@$log" "$zip" "$json"
package/update_release.py
0 → 100755
View file @
9c95c4d7
#!/usr/bin/env python3
from
github
import
Github
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'Refresh a set of files in an existing release'
)
parser
.
add_argument
(
'--token'
,
help
=
"Github Personal Access Token (PAT)"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'--repo'
,
help
=
"Repository"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'--tag'
,
help
=
"Release tag"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'files'
,
nargs
=
argparse
.
REMAINDER
)
args
=
parser
.
parse_args
()
if
len
(
args
.
files
)
==
0
:
print
(
"ERROR: No files specified"
)
quit
()
gh
=
Github
(
login_or_token
=
args
.
token
)
repo
=
gh
.
get_repo
(
str
(
args
.
repo
))
for
fn
in
args
.
files
:
release
=
repo
.
get_release
(
args
.
tag
)
for
asset
in
release
.
get_assets
():
if
asset
.
name
==
fn
:
print
(
"Found '"
+
fn
+
"', updating"
)
asset
.
delete_asset
()
release
.
upload_asset
(
fn
)
package/upload_release.py
View file @
9c95c4d7
...
...
@@ -2,10 +2,8 @@
from
github
import
Github
import
argparse
import
re
parser
=
argparse
.
ArgumentParser
(
description
=
'Upload a set of files to a new draft release'
)
parser
.
add_argument
(
'--user'
,
help
=
"Github username"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'--token'
,
help
=
"Github Personal Access Token (PAT)"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'--repo'
,
help
=
"Repository"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'--tag'
,
help
=
"Release tag"
,
type
=
str
,
required
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment