Skip to content

Commit

Permalink
ci: change versioning scheme (#208)
Browse files Browse the repository at this point in the history
Summary:
Stack created with [Sapling]
* __->__ #208

[sl] ci: change versioning scheme

This changes our versioning scheme to `VERSION-%Y%m%d-%H%M%S-HASH`, where `VERSION` is defined in the VERSION file, `%Y%m%d-%H%M%S` is the current date, hour, minutes, and seconds, and `HASH` is the hash of the current commit.

Pull Request resolved: #208

Test Plan: Tested on my personal account

Reviewed By: bolinfest

Differential Revision: D41418387

Pulled By: sggutier

fbshipit-source-id: f89bce7cc842c6ca77c3a8330565fa19d41e39cc
  • Loading branch information
sggutier authored and facebook-github-bot committed Nov 19, 2022
1 parent eb41bc9 commit cfbb68a
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: git config --global --add safe.directory "$PWD"
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: Prepare build environment
run: 'eden/scm/packaging/mac/prepare_environment.py \
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Create Sapling bottle
run: brew bottle sapling
- name: Rename bottle to some platform specific name
run: mv sapling*monterey.bottle.tar.gz sapling_0.0-${{ env.SAPLING_VERSION }}.arm64_monterey.bottle.tar.gz
run: mv sapling*monterey.bottle.tar.gz sapling_${{ env.SAPLING_VERSION }}.arm64_monterey.bottle.tar.gz
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sapling-cli-homebrew-macos-x86-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: git config --global --add safe.directory "$PWD"
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: Prepare build environment
run: 'eden/scm/packaging/mac/prepare_environment.py \
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Create Sapling bottle
run: brew bottle sapling
- name: Rename bottle to some platform specific name
run: mv sapling*monterey.bottle.tar.gz sapling_0.0-${{ env.SAPLING_VERSION }}.monterey.bottle.tar.gz
run: mv sapling*monterey.bottle.tar.gz sapling_${{ env.SAPLING_VERSION }}.monterey.bottle.tar.gz
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sapling-cli-ubuntu-20.04-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
run: rustup default stable
- name: set-env DEB_UPSTREAM_VERSION
shell: bash
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: Create .deb
working-directory: ./eden/scm
run: ${{ format('VERSION=0.0-{0} make deb', env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('VERSION={0} make deb', env.DEB_UPSTREAM_VERSION) }}
- name: Rename .deb
working-directory: ./eden/scm
run: ${{ format('mv sapling_0.0-{0}_amd64.deb sapling_0.0-{0}_amd64.Ubuntu20.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('mv sapling_{0}_amd64.deb sapling_{0}_amd64.Ubuntu20.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
8 changes: 4 additions & 4 deletions .github/workflows/sapling-cli-ubuntu-20.04-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
run: rustup default stable
- name: set-env DEB_UPSTREAM_VERSION
shell: bash
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: Create .deb
working-directory: ./eden/scm
run: ${{ format('VERSION=0.0-{0} make deb', env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('VERSION={0} make deb', env.DEB_UPSTREAM_VERSION) }}
- name: Rename .deb
working-directory: ./eden/scm
run: ${{ format('mv sapling_0.0-{0}_amd64.deb sapling_0.0-{0}_amd64.Ubuntu20.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('mv sapling_{0}_amd64.deb sapling_{0}_amd64.Ubuntu20.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sapling-cli-ubuntu-22.04-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
run: rustup default stable
- name: set-env DEB_UPSTREAM_VERSION
shell: bash
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: Create .deb
working-directory: ./eden/scm
run: ${{ format('VERSION=0.0-{0} make deb', env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('VERSION={0} make deb', env.DEB_UPSTREAM_VERSION) }}
- name: Rename .deb
working-directory: ./eden/scm
run: ${{ format('mv sapling_0.0-{0}_amd64.deb sapling_0.0-{0}_amd64.Ubuntu22.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('mv sapling_{0}_amd64.deb sapling_{0}_amd64.Ubuntu22.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
8 changes: 4 additions & 4 deletions .github/workflows/sapling-cli-ubuntu-22.04-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
run: rustup default stable
- name: set-env DEB_UPSTREAM_VERSION
shell: bash
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "DEB_UPSTREAM_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: Create .deb
working-directory: ./eden/scm
run: ${{ format('VERSION=0.0-{0} make deb', env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('VERSION={0} make deb', env.DEB_UPSTREAM_VERSION) }}
- name: Rename .deb
working-directory: ./eden/scm
run: ${{ format('mv sapling_0.0-{0}_amd64.deb sapling_0.0-{0}_amd64.Ubuntu22.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
run: ${{ format('mv sapling_{0}_amd64.deb sapling_{0}_amd64.Ubuntu22.04.deb', env.DEB_UPSTREAM_VERSION, env.DEB_UPSTREAM_VERSION) }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sapling-cli-windows-amd64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: vcpkg integrate install
- name: set-env SAPLING_VERSION
shell: bash
run: echo "SAPLING_VERSION=$(ci/tag-name.sh | tr \- .)" >> $GITHUB_ENV
run: echo "SAPLING_VERSION=$(ci/tag-name.sh)" >> $GITHUB_ENV
- name: build and zip
run: python3 ./eden/scm/packaging/windows/build_windows_zip.py
- name: rename .zip
Expand Down
1 change: 1 addition & 0 deletions SAPLING_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1
16 changes: 7 additions & 9 deletions ci/gen_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,17 @@ def gen_build_ubuntu_cli_job(self, *, ubuntu_version: str, deb_version_expr: str
"name": "rustup",
"run": "rustup default stable",
},
create_set_env_step(
DEB_UPSTREAM_VERSION, "$(ci/tag-name.sh | tr \\- .)"
),
create_set_env_step(SAPLING_VERSION, "$(ci/tag-name.sh | tr \\- .)"),
create_set_env_step(DEB_UPSTREAM_VERSION, "$(ci/tag-name.sh)"),
create_set_env_step(SAPLING_VERSION, "$(ci/tag-name.sh)"),
{
"name": "Create .deb",
"working-directory": "./eden/scm",
"run": f"${{{{ format('VERSION=0.0-{{0}} make deb', env.{DEB_UPSTREAM_VERSION}) }}}}",
"run": f"${{{{ format('VERSION={{0}} make deb', env.{DEB_UPSTREAM_VERSION}) }}}}",
},
{
"name": "Rename .deb",
"working-directory": "./eden/scm",
"run": f"${{{{ format('mv sapling_0.0-{{0}}_amd64.deb sapling_0.0-{{0}}_amd64.Ubuntu{ubuntu_version}.deb', env.{DEB_UPSTREAM_VERSION}, env.{DEB_UPSTREAM_VERSION}) }}}}",
"run": f"${{{{ format('mv sapling_{{0}}_amd64.deb sapling_{{0}}_amd64.Ubuntu{ubuntu_version}.deb', env.{DEB_UPSTREAM_VERSION}, env.{DEB_UPSTREAM_VERSION}) }}}}",
},
],
}
Expand Down Expand Up @@ -312,7 +310,7 @@ def gen_windows_release(self) -> str:
},
# This makes vcpkg packages available globally.
{"name": "integrate vcpkg", "run": "vcpkg integrate install"},
create_set_env_step(SAPLING_VERSION, "$(ci/tag-name.sh | tr \\- .)"),
create_set_env_step(SAPLING_VERSION, "$(ci/tag-name.sh)"),
{
"name": "build and zip",
"run": "python3 ./eden/scm/packaging/windows/build_windows_zip.py",
Expand Down Expand Up @@ -357,7 +355,7 @@ def gen_homebrew_macos_release(
"steps": [
{"name": "Checkout Code", "uses": "actions/checkout@v3"},
grant_repo_access(),
create_set_env_step(SAPLING_VERSION, "$(ci/tag-name.sh | tr \\- .)"),
create_set_env_step(SAPLING_VERSION, "$(ci/tag-name.sh)"),
{
"name": "Prepare build environment",
"run": "eden/scm/packaging/mac/prepare_environment.py \\\n"
Expand All @@ -377,7 +375,7 @@ def gen_homebrew_macos_release(
},
{
"name": "Rename bottle to some platform specific name",
"run": "mv %s sapling_0.0-${{ env.SAPLING_VERSION }}.%s"
"run": "mv %s sapling_${{ env.SAPLING_VERSION }}.%s"
% (artifact_glob, final_ext),
},
upload_artifact(artifact_key, artifact_glob),
Expand Down
5 changes: 4 additions & 1 deletion ci/tag-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

git -c "core.abbrev=8" show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S"
DIR=$(dirname -- "$0")
VERSION=$(cat "$DIR"/../SAPLING_VERSION)
COMMIT_INFO=$(git -c "core.abbrev=8" show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S")
echo "$VERSION"."$COMMIT_INFO"

0 comments on commit cfbb68a

Please sign in to comment.