Skip to content

Commit

Permalink
Update package script to accept a postfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomthom committed Jan 3, 2024
1 parent ab29876 commit de36d90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Find the short git sha.
- name: Setup variables
id: vars
run: echo "sha_short=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT
- name: Check outputs
run: echo ${{ steps.vars.outputs.sha_short }}
# git_hash=$(git rev-parse --short "$GITHUB_SHA")

# - name: Check outputs
# run: echo ${{ steps.vars.outputs.sha_short }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand All @@ -41,20 +40,13 @@ jobs:
# - run: npm test
- run: npm install
- run: npm run build
- run: npm run package

- shell: bash
run: |
fVar=$(find -type f -name 'archive/*.rbz');
echo $fVar # output is like ./file-1.2.0-SNAPSHOT.txt
fT=${fVar:2} # removing first two characters'./'
echo "$fT" # output is file-1.2.0-SNAPSHOT.txt
echo $fVar >> $GITHUB_OUTPUT
# - run: npm run package
- run: ruby ./tools/package.rb ${{ steps.vars.outputs.sha_short }}

- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: Extension
path: archive/*.rbz
if-no-files-found: error

6 changes: 5 additions & 1 deletion tools/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@
version = extension[:version]
puts "Version: #{version}"

# Useful for stuff like git sha.
# ruby tools/package 02f5d6
postfix = ARGV[0] ? "-#{ARGV[0]}" : ''


build_version = version
build_date = Time.now.strftime("%Y-%m-%d")

archive_name = "#{extension_id}_#{build_version}_#{build_date}"
archive_name = "#{extension_id}_#{build_version}_#{build_date}#{postfix}"
archive = File.join(archive_path, "#{archive_name}.rbz")

build_files_pattern = File.join(build_path, "**", "**")
Expand Down

0 comments on commit de36d90

Please sign in to comment.