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

Initial PR-based artifact update workflow #15

Merged
merged 63 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c589839
First pass on build workflow
omus Jan 26, 2024
b1b2c66
Add pull_request event for now
omus Jan 26, 2024
47ac52c
Fix include path
omus Jan 26, 2024
492bca1
Julia shell has quirks
omus Jan 26, 2024
1c35938
Attempt download artifact in CI workflow
omus Jan 28, 2024
19f6c72
Commit auto-generated Artifact.toml
omus Jan 28, 2024
e2960db
Iterating
omus Jan 28, 2024
ae26484
Iterating
omus Jan 28, 2024
45254b3
Avoid requiring more packages
omus Jan 28, 2024
43e0677
fixup! Avoid requiring more packages
omus Jan 28, 2024
e31b690
Basic overrides test
omus Jan 28, 2024
bf0cbd3
fixup! Basic overrides test
omus Jan 28, 2024
cf7ca39
fixup! Basic overrides test
omus Jan 28, 2024
2e43beb
fixup! Basic overrides test
omus Jan 28, 2024
185508a
Debugging
omus Jan 28, 2024
05d4cb2
Iterating
omus Jan 28, 2024
240ca1b
Whoops
omus Jan 28, 2024
e73d9f5
Should be it
omus Jan 28, 2024
e679906
Pkg work around
omus Jan 28, 2024
73861cd
Create minimal Artifacts.toml
omus Jan 28, 2024
7b67759
fixup! Create minimal Artifacts.toml
omus Jan 28, 2024
2b5026a
Test empty artifact
omus Jan 29, 2024
8d41366
Use valid Artifacts.toml file
omus Jan 29, 2024
9354be9
Debug
omus Jan 29, 2024
b8af5f7
Max fetch-depth
omus Jan 29, 2024
77857a9
Checkout from remote
omus Jan 29, 2024
8ad4b46
Use content hash
omus Jan 29, 2024
1de5d41
fixup! Use content hash
omus Jan 29, 2024
fd13d93
Go back to path
omus Jan 29, 2024
3307c80
Unpublished artifact tests
omus Jan 30, 2024
3e51a87
fixup! Unpublished artifact tests
omus Jan 30, 2024
2536b28
Release workflow
omus Jan 30, 2024
7606a52
Fixes
omus Jan 30, 2024
890ad36
Fix tests
omus Jan 30, 2024
c01a213
Iterating
omus Jan 30, 2024
1db9d5c
Test fix
omus Jan 30, 2024
ae92514
fixup! Iterating
omus Jan 30, 2024
b3e6670
Update package version
omus Jan 30, 2024
af2e8c7
Try out PR creation
omus Jan 30, 2024
1042ea1
Fix tests
omus Jan 30, 2024
f8de28d
Fix key
omus Jan 30, 2024
fda4856
Set workflow permissions
omus Jan 30, 2024
8f57db7
Test origin/HEAD
omus Jan 30, 2024
a972d18
Use main
omus Jan 30, 2024
15ff6c9
Fix ref
omus Jan 30, 2024
3177980
Set base
omus Jan 30, 2024
f2f8ac7
Iterating
omus Jan 30, 2024
34802b6
Fix workflow link
omus Jan 30, 2024
ecb84d3
Link is broken
omus Jan 30, 2024
8de2f0f
Try PAT for PR
omus Jan 30, 2024
20ce053
Change something about the PR
omus Jan 30, 2024
0eed109
Another PR is required?
omus Jan 30, 2024
bfa1401
Iterating
omus Jan 30, 2024
1a17a26
Finish rename
omus Jan 30, 2024
5f7e8f0
Attempt making a release
omus Jan 30, 2024
c2e16a6
Fix artifacts pattern
omus Jan 30, 2024
5a6360f
Tweak
omus Jan 30, 2024
cb49b13
Fixes
omus Jan 30, 2024
8bf10e1
Ensure release action fails before making release
omus Jan 30, 2024
51ffb81
Fail earlier
omus Jan 30, 2024
233d8e9
Release should now work
omus Jan 30, 2024
0d89009
Ready to merge
omus Jan 30, 2024
3e83df3
Only restore project version
omus Jan 30, 2024
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
45 changes: 45 additions & 0 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Build
on:
pull_request:
workflow_dispatch:
inputs:
tzdata_version:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
env:
JULIA_PROJECT: gen
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: "1"
- uses: julia-actions/cache@v1
- name: Instantiate
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.instantiate()
- name: Build tzdata
id: build
shell: julia --color=yes {0}
run: |
include("gen/make.jl")
omus marked this conversation as resolved.
Show resolved Hide resolved
(; tarball_path) = update_tzdata()
@show tarball_path
open(ENV["GITHUB_OUTPUT"], "a") do io
println(io, "tarball_path=$tarball_path")
println(io, "tarball_name=$(basename(tarball_path))")
end
- name: Debug
run: |
echo "${{ steps.build.outputs.tarball_path }}"
git diff
- uses: actions/upload-artifact@v4
id: action-artifact
with:
name: ${{ steps.build.outputs.tarball_name }}
path: ${{ steps.build.outputs.tarball_path }}
66 changes: 50 additions & 16 deletions gen/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,35 +109,44 @@ function upload_to_github_release(owner, repo_name, commit, tag, path; token=ENV
run(cmd)
end

# TODO: Re-running always bumps version
if abspath(PROGRAM_FILE) == @__FILE__
tzdata_version = tzdata_latest_version()
tarball_name = "tzjfile-v1-tzdata$(tzdata_version).tar.gz"

# Build tzjfile artifact content
# TZData.cleanup(tzdata_version, _scratch_dir())
compiled_dir = TZData.build(tzdata_version, _scratch_dir())

@info "Creating tarball $tarball_name"
tarball_path = joinpath(tempdir(), tarball_name)
create_tarball(compiled_dir, tarball_path)

function update_tzdata()
repo_path = joinpath(@__DIR__, "..")
pkg_url = remote_url(repo_path)

# Read Project.toml
project_toml = joinpath(repo_path, "Project.toml")
project = read_project(project_toml)
old_version = project.version
new_version = Base.nextpatch(project.version)
old_tzdata_version = only(old_version.build)

# Always fetch the current list of tzdata versions (ignoring any caching).
tzdata_versions = TZData.tzdata_versions()
i = findfirst(==(old_tzdata_version), tzdata_versions)
if i == length(tzdata_versions)
new_tzdata_version = tzdata_versions[i]
new_version = Base.nextpatch(old_version)
else
new_tzdata_version = tzdata_versions[i + 1]
new_version = Base.nextminor(old_version)
end

tarball_name = "tzjfile-v1-tzdata$(new_tzdata_version).tar.gz"

# Build tzjfile artifact content
# TZData.cleanup(new_tzdata_version, _scratch_dir())
compiled_dir = TZData.build(new_tzdata_version, _scratch_dir())

@info "Creating tarball $tarball_name"
tarball_path = joinpath(tempdir(), tarball_name)
create_tarball(compiled_dir, tarball_path)

# Include tzdata version in build number
new_version = VersionNumber(
new_version.major,
new_version.minor,
new_version.patch,
(),
(tzdata_version,),
(new_tzdata_version,),
)

@info "Bumping package $(project.name) from $old_version -> $new_version"
Expand All @@ -156,10 +165,35 @@ if abspath(PROGRAM_FILE) == @__FILE__
force=true,
)

return (;
repo_path,
project_toml,
artifacts_toml,
artifact_url,
tarball_path,
old_tzdata_version,
new_tzdata_version,
old_version,
new_version,
)
end

# TODO: Re-running always bumps version
if abspath(PROGRAM_FILE) == @__FILE__
(;
repo_path,
new_tzdata_version,
new_version,
project_toml,
artifacts_toml,
artifact_url,
tarball_path,
) = update_tzdata()

# TODO: Ensure no other files are staged before committing
@info "Committing and pushing Project.toml and Artifacts.toml"
branch = "main"
message = "Set artifact to tzdata$(tzdata_version) and project to $(new_version)"
message = "Set artifact to tzdata$(new_tzdata_version) and project to $(new_version)"

# TODO: ghr and LibGit2 use different credential setups. Double check
# what BB does here.
Expand Down
Loading