remove --no-bytecode
#2125
Workflow file for this run
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
name: ci | |
on: | |
push: | |
branches: [main] | |
tags: ['*'] | |
pull_request: | |
branches: [main] | |
jobs: | |
standard: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- run: npm install | |
- run: npm run standard | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: install shellspec | |
run: curl -sfSL https://git.io/shellspec | sh -s 0.28.1 --yes | |
- run: which shellspec | |
- run: npm install | |
- run: | | |
npm run test 2>&1 | tee testResults.txt | |
test ${PIPESTATUS[0]} -eq 0 | |
- name: set test count | |
env: | |
GIST_TOKEN: ${{ secrets.GIST_TOKEN }} | |
run: | | |
TEST_COUNT=$(tail -2 testResults.txt | head -1 | awk -F'[,: ]+' '/total/ {print $4}') | |
export LC_NUMERIC="en_US.UTF-8" | |
TEST_COUNT_FORMATTED=$(printf "%'d\n" $(($TEST_COUNT))) | |
echo $TEST_COUNT_FORMATTED | |
curl -L \ | |
-X PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GIST_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/gists/bb76445765a9731e7d824a6efdf53524 \ | |
-d "{\"description\":\"dotenvxTestCount\",\"files\":{\"dotenvxTestCount.json\":{\"content\":\"{ \\\"schemaVersion\\\": 1, \\\"label\\\": \\\"test suite\\\", \\\"message\\\": \\\"$TEST_COUNT_FORMATTED\\\", \\\"color\\\": \\\"green\\\" }\"}}}" | |
- run: npm run testshell | |
- run: npm audit --omit=dev | |
test-coverage: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: install shellspec | |
run: curl -sfSL https://git.io/shellspec | sh -s 0.28.1 --yes | |
- run: which shellspec | |
- run: npm install | |
- run: npm run test-coverage | |
test-pkg: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- run: npm install | |
- name: pkg | |
run: | | |
echo "pkg-ing" | |
node esbuild.js | |
cd ./build | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-linuxstatic-x86_64 --output ../bin/linux-x86_64/dotenvx | |
- name: verify version | |
run: | | |
cd bin/linux-x86_64/ | |
RELEASED_VERSION=$(./dotenvx --version) | |
EXPECTED_VERSION=$(node -p "require('./../../package.json').version") | |
echo $RELEASED_VERSION | |
echo $EXPECTED_VERSION | |
if [ "$RELEASED_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
fi | |
- name: verify dotenvx run/get | |
run: | | |
cd bin/linux-x86_64/ | |
echo "HELLO=Ubuntu" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(./dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(./dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Ubuntu" ]; then | |
echo "postrelease dotenvx get failure: expected Ubuntu, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
- name: verify nested invocations | |
run: | | |
cd bin/linux-x86_64/ | |
echo "HELLO=Ubuntu" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(./dotenvx run --quiet -- ./dotenvx run --quiet -- ./dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx nested invocations: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
- name: verify dotenvx encrypt then run/get then decrypt then run/get | |
run: | | |
cd bin/linux-x86_64/ | |
echo "HELLO=Ubuntu" > .env | |
./dotenvx encrypt | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(./dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(./dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Ubuntu" ]; then | |
echo "postrelease dotenvx get failure: expected Ubuntu, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
./dotenvx decrypt | |
EXPECTED_MESSAGE=$(./dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(./dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Ubuntu" ]; then | |
echo "postrelease dotenvx get failure: expected Ubuntu, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
# run only on semantic version tag | |
release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.') | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
# GITHUB_ENV operates like a .env file | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
# https://news.ycombinator.com/item?id=32388964 | |
# https://github.com/procursusteam/ldid | |
# https://www.pulumi.com/blog/nodejs-binaries-with-pkg/ | |
# https://github.com/pulumi/pulumi-aws-static-website/blob/main/.github/workflows/release.yaml | |
- name: ldid for macos binary building | |
uses: MOZGIII/install-ldid-action@v1 | |
with: | |
tag: v2.1.5-procursus2 | |
- name: npm install | |
run: npm install | |
- name: pkg | |
run: | | |
echo "pkg-ing" | |
node esbuild.js | |
cd ./build | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-macos-x64 --output ../bin/darwin-amd64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-macos-x64 --output ../bin/darwin-x86_64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-macos-arm64 --output ../bin/darwin-arm64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-linuxstatic-x64 --output ../bin/linux-amd64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-linuxstatic-x64 --output ../bin/linux-x86_64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-linuxstatic-arm64 --output ../bin/linux-arm64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-linuxstatic-arm64 --output ../bin/linux-aarch64/dotenvx | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-win-x64 --output ../bin/windows-amd64/dotenvx.exe | |
../node_modules/.bin/pkg . --public-packages "*" --public --target node20-win-x64 --output ../bin/windows-x86_64/dotenvx.exe | |
cd .. | |
echo "change ownership" | |
sudo chown -R root:root bin/ | |
echo "dist-ing" | |
mkdir -p dist | |
mkdir -p dist2 | |
mkdir -p dist2/${{ env.VERSION }} | |
mkdir -p dist2/latest | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-darwin-amd64.tar.gz -C bin/darwin-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-darwin-x86_64.tar.gz -C bin/darwin-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-darwin-arm64.tar.gz -C bin/darwin-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-amd64.tar.gz -C bin/linux-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-x86_64.tar.gz -C bin/linux-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-arm64.tar.gz -C bin/linux-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-aarch64.tar.gz -C bin/linux-aarch64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-amd64.tar.gz -C bin/windows-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.tar.gz -C bin/windows-x86_64/ . | |
zip -j ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-amd64.zip bin/windows-amd64/dotenvx.exe | |
zip -j ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.zip bin/windows-x86_64/dotenvx.exe | |
tar --gzip -cf ./dist/dotenvx-darwin-amd64.tar.gz -C bin/darwin-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-darwin-x86_64.tar.gz -C bin/darwin-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-darwin-arm64.tar.gz -C bin/darwin-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-amd64.tar.gz -C bin/linux-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-x86_64.tar.gz -C bin/linux-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-arm64.tar.gz -C bin/linux-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-aarch64.tar.gz -C bin/linux-aarch64/ . | |
tar --gzip -cf ./dist/dotenvx-windows-amd64.tar.gz -C bin/windows-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-windows-x86_64.tar.gz -C bin/windows-x86_64/ . | |
zip -j ./dist/dotenvx-windows-amd64.zip bin/windows-amd64/dotenvx.exe | |
zip -j ./dist/dotenvx-windows-x86_64.zip bin/windows-x86_64/dotenvx.exe | |
tar --gzip -cf ./dist2/latest/dotenvx-darwin-amd64.tar.gz -C bin/darwin-amd64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-darwin-x86_64.tar.gz -C bin/darwin-x86_64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-darwin-arm64.tar.gz -C bin/darwin-arm64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-amd64.tar.gz -C bin/linux-amd64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-x86_64.tar.gz -C bin/linux-x86_64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-arm64.tar.gz -C bin/linux-arm64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-aarch64.tar.gz -C bin/linux-aarch64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-windows-amd64.tar.gz -C bin/windows-amd64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-windows-x86_64.tar.gz -C bin/windows-x86_64/ . | |
zip -j ./dist2/latest/dotenvx-windows-amd64.zip bin/windows-amd64/dotenvx.exe | |
zip -j ./dist2/latest/dotenvx-windows-x86_64.zip bin/windows-x86_64/dotenvx.exe | |
- name: update install.sh with VERSION | |
run: | | |
sed "0,/^VERSION=\".*\"/s//VERSION=\"${{ env.CLEAN_VERSION }}\"/" install.sh > ./dist/install.sh | |
sed "0,/^VERSION=\".*\"/s//VERSION=\"${{ env.CLEAN_VERSION }}\"/" install.sh > ./dist2/install.sh | |
- name: create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/*.tar.gz | |
dist/*.zip | |
dist/install.sh | |
body: "see [CHANGELOG](https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md)" | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: publish checksums to release | |
uses: wangzuo/action-release-checksums@main | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: checkout dotenvx/releases repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "dotenvx/releases" | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
path: "releases" | |
- name: copy dist2 files to release repo | |
run: | | |
mkdir -p releases/latest | |
cp -r dist2/* releases/ | |
echo "${{ env.CLEAN_VERSION }}" > releases/VERSION | |
cp README.md releases/latest/README.md | |
- name: commit and push | |
run: | | |
cd releases | |
git config --global user.name 'motdotenv' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "${{ env.VERSION }}" | |
git tag "${{ env.VERSION }}" | |
git push origin HEAD --tags | |
homebrew: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
# https://github.com/Justintime50/homebrew-releaser | |
- name: homebrew releaser | |
uses: Justintime50/homebrew-releaser@v1 | |
with: | |
debug: false | |
homebrew_owner: dotenvx | |
homebrew_tap: homebrew-brew | |
formula_folder: Formula | |
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
commit_owner: motdotenv | |
commit_email: [email protected] | |
install: | | |
bin.install "dotenvx" | |
bin.install_symlink "dotenvx" => "git-dotenvx" | |
test: | | |
system bin/"dotenvx", "--version" | |
target_darwin_amd64: true | |
target_darwin_arm64: true | |
target_linux_amd64: true | |
target_linux_arm64: true | |
update_readme_table: true | |
npm: | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@dotenvx' | |
# update npm to v9 (last 16.x supported version) for npm provenance to work | |
- run: npm install -g npm@9 | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
docker: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
# GITHUB_ENV operates like a .env file | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: dotenv/dotenvx:latest | |
platforms: linux/amd64,linux/arm64 | |
- name: Build and push tag | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: dotenv/dotenvx:${{ env.VERSION }} | |
platforms: linux/amd64,linux/arm64 | |
- uses: actions/checkout@v4 | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: dotenv/dotenvx | |
short-description: ${{ github.event.repository.description }} | |
winget: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
# GITHUB_ENV operates like a .env file | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: checkout dotenvx/winget-pkgs repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "dotenvx/winget-pkgs" | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
path: "winget-pkgs" | |
- name: git config and pull | |
run: | | |
cd winget-pkgs | |
git config --global user.name 'motdotenv' | |
git config --global user.email '[email protected]' | |
git branch | |
git branch dotenvx-dotenvx-${{ env.CLEAN_VERSION }} | |
git checkout dotenvx-dotenvx-${{ env.CLEAN_VERSION }} | |
- name: check if branch exists and pull | |
run: | | |
cd winget-pkgs | |
BRANCH_EXISTS=$(git ls-remote --heads origin dotenvx-dotenvx-${{ env.CLEAN_VERSION }} | wc -l) | |
if [ "$BRANCH_EXISTS" -eq 1 ]; then | |
git pull origin dotenvx-dotenvx-${{ env.CLEAN_VERSION }} | |
else | |
echo "Branch does not exist on the remote; skipping pull." | |
fi | |
- name: create dotenvx.dotenvx.yaml | |
run: | | |
cd winget-pkgs | |
mkdir -p manifests/d/dotenvx/dotenvx/${{ env.CLEAN_VERSION }} | |
cat <<EOT > manifests/d/dotenvx/dotenvx/${{ env.CLEAN_VERSION }}/dotenvx.dotenvx.yaml | |
PackageIdentifier: dotenvx.dotenvx | |
PackageVersion: ${{ env.CLEAN_VERSION }} | |
DefaultLocale: en-US | |
ManifestType: version | |
ManifestVersion: 1.6.0 | |
EOT | |
- name: create dotenvx.dotenvx.locale.en-US.yaml | |
run: | | |
cd winget-pkgs | |
mkdir -p manifests/d/dotenvx/dotenvx/${{ env.CLEAN_VERSION }} | |
cat <<EOT > manifests/d/dotenvx/dotenvx/${{ env.CLEAN_VERSION }}/dotenvx.dotenvx.locale.en-US.yaml | |
PackageIdentifier: dotenvx.dotenvx | |
PackageVersion: ${{ env.CLEAN_VERSION }} | |
PackageLocale: en-US | |
Publisher: dotenvx | |
PublisherUrl: https://dotenvx.com | |
Author: motdotla | |
PackageName: dotenvx | |
PackageUrl: https://github.com/dotenvx/dotenvx | |
License: BSD-3-Clause | |
ShortDescription: a better dotenv–from the creator of dotenv | |
Description: a better dotenv–from the creator of dotenv | |
Tags: ["env", "dotenv", "environment", "variables", "dotenvx", "cli", "encryption"] | |
Moniker: dotenvx | |
ManifestType: defaultLocale | |
ManifestVersion: 1.6.0 | |
EOT | |
- name: calculate sha256 for x64 installer | |
run: | | |
INSTALLER_URL="https://github.com/dotenvx/dotenvx/releases/download/${{ env.VERSION }}/dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.zip" | |
curl -L $INSTALLER_URL -o dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.zip | |
SHA_X86=$(sha256sum dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.zip | awk '{ print $1 }') | |
echo "SHA_X86=$SHA_X86" >> $GITHUB_ENV | |
- name: create dotenvx.dotenvx.installer.yaml | |
run: | | |
cd winget-pkgs | |
mkdir -p manifests/d/dotenvx/dotenvx/${{ env.CLEAN_VERSION }} | |
CURRENT_DATE=$(date +"%Y-%m-%d") | |
cat <<EOT > manifests/d/dotenvx/dotenvx/${{ env.CLEAN_VERSION }}/dotenvx.dotenvx.installer.yaml | |
PackageIdentifier: dotenvx.dotenvx | |
PackageVersion: ${{ env.CLEAN_VERSION }} | |
InstallerLocale: en-US | |
InstallerType: zip | |
ReleaseDate: "$CURRENT_DATE" | |
Installers: | |
- Architecture: x64 | |
NestedInstallerType: portable | |
NestedInstallerFiles: | |
- RelativeFilePath: dotenvx.exe | |
PortableCommandAlias: dotenvx | |
InstallerUrl: https://github.com/dotenvx/dotenvx/releases/download/${{ env.VERSION }}/dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.zip | |
InstallerSha256: ${{ env.SHA_X86 }} | |
UpgradeBehavior: uninstallPrevious | |
ManifestType: installer | |
ManifestVersion: 1.6.0 | |
EOT | |
- name: commit and push | |
run: | | |
cd winget-pkgs | |
git add . | |
git commit -m "New version: dotenvx.dotenvx ${{ env.CLEAN_VERSION }}" --allow-empty | |
git branch | |
git push origin dotenvx-dotenvx-${{ env.CLEAN_VERSION }} | |
- name: create pull request | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
cd winget-pkgs | |
gh pr create --repo microsoft/winget-pkgs \ | |
--base master \ | |
--head dotenvx:dotenvx-dotenvx-${{ env.CLEAN_VERSION }} \ | |
--title "New version: dotenvx.dotenvx ${{ env.CLEAN_VERSION }}" \ | |
--body "New version: dotenvx.dotenvx ${{ env.CLEAN_VERSION }}" | |
dotenvx-darwin-amd64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: darwin-amd64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-darwin-arm64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: darwin-arm64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-darwin-x86_64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: darwin-x86_64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-aarch64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-aarch64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-amd64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-amd64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-arm64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-arm64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-x86_64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-x86_64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-windows-amd64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: windows-amd64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-windows-x86_64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: windows-x86_64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
# aggregate publish-all job to wait for all previous jobs to complete | |
publish-all: | |
runs-on: ubuntu-latest | |
needs: | |
- homebrew | |
- npm | |
- dotenvx-darwin-amd64 | |
- dotenvx-darwin-arm64 | |
- dotenvx-darwin-x86_64 | |
- dotenvx-linux-aarch64 | |
- dotenvx-linux-amd64 | |
- dotenvx-linux-arm64 | |
- dotenvx-linux-x86_64 | |
- dotenvx-windows-amd64 | |
- dotenvx-windows-x86_64 | |
steps: | |
- name: publish-all aggregate step | |
run: echo "publish-all completed" | |
dotenvx-sh: | |
needs: publish-all | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: update install.sh with VERSION | |
run: | | |
mkdir -p dist | |
sed "0,/^VERSION=\".*\"/s//VERSION=\"${{ env.CLEAN_VERSION }}\"/" install.sh > ./dist/install.sh | |
- name: checkout dotenvx/dotenvx.sh repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "dotenvx/dotenvx.sh" | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
path: "dotenvx.sh" | |
- name: copy install.sh to dotenvx.sh repo | |
run: | | |
cp dist/install.sh dotenvx.sh/install.sh | |
echo "${{ env.CLEAN_VERSION }}" > dotenvx.sh/VERSION | |
- name: commit and push | |
run: | | |
cd dotenvx.sh | |
git config --global user.name 'motdotenv' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "${{ env.VERSION }}" --allow-empty | |
git tag "${{ env.VERSION }}" --force | |
git push origin HEAD --tags --force | |
confirm-dotenvx-sh: | |
needs: dotenvx-sh | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: wait for deployment | |
run: | | |
end=$((SECONDS+300)) | |
while [ $SECONDS -lt $end ]; do | |
current_version=$(curl -s -L https://dotenvx.sh/VERSION) | |
if [ "$current_version" == "${{ env.CLEAN_VERSION }}" ]; then | |
echo "dotenvx.sh deployment successful with version $current_version" | |
exit 0 | |
fi | |
echo "waiting for deployment..." | |
sleep 10 | |
done | |
echo "[DEPLOYMENT_FAILED]: VERSION did not update to ${{ env.CLEAN_VERSION }} within 5 minutes" | |
exit 1 | |
postrelease-npm: | |
needs: confirm-dotenvx-sh | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: verify version | |
run: | | |
npm install @dotenvx/dotenvx --save | |
RELEASED_VERSION=$(npx @dotenvx/dotenvx --version) | |
EXPECTED_VERSION=$(node -p "require('./package.json').version") | |
echo $RELEASED_VERSION | |
echo $EXPECTED_VERSION | |
if [ "$RELEASED_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
fi | |
- name: verify dotenvx run/get | |
run: | | |
npm install @dotenvx/dotenvx --save | |
echo "HELLO=NPM" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(npx @dotenvx/dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello NPM" ]; then | |
echo "postrelease dotenvx run failure: expected Hello NPM, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(npx @dotenvx/dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "NPM" ]; then | |
echo "postrelease dotenvx get failure: expected NPM, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
postrelease-ubuntu: | |
needs: confirm-dotenvx-sh | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: install dotenvx | |
run: curl -fsS https://dotenvx.sh/ | sh | |
- name: verify version | |
run: | | |
RELEASED_VERSION=$(dotenvx --version) | |
EXPECTED_VERSION=$(node -p "require('./package.json').version") | |
echo $RELEASED_VERSION | |
echo $EXPECTED_VERSION | |
if [ "$RELEASED_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
fi | |
- name: verify dotenvx run/get | |
run: | | |
echo "HELLO=Ubuntu" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Ubuntu" ]; then | |
echo "postrelease dotenvx get failure: expected Ubuntu, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
- name: verify nested invocations | |
run: | | |
echo "HELLO=Ubuntu" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(dotenvx run --quiet -- dotenvx run --quiet -- dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx nested invocations: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
postrelease-mac: | |
needs: confirm-dotenvx-sh | |
runs-on: macos-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: install dotenvx | |
run: brew install dotenvx/brew/dotenvx | |
- name: verify version | |
run: | | |
RELEASED_VERSION=$(dotenvx --version) | |
EXPECTED_VERSION=$(node -p "require('./package.json').version") | |
echo $RELEASED_VERSION | |
echo $EXPECTED_VERSION | |
if [ "$RELEASED_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
fi | |
- name: verify dotenvx run/get | |
run: | | |
echo "HELLO=Mac" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Mac" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Mac, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Mac" ]; then | |
echo "postrelease dotenvx get failure: expected Mac, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
- name: verify nested invocations | |
run: | | |
echo "HELLO=Mac" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(dotenvx run --quiet -- dotenvx run --quiet -- dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Mac" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Mac, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
postrelease-windows: | |
needs: confirm-dotenvx-sh | |
runs-on: windows-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: install dotenvx | |
run: | | |
curl -L -o dotenvx-windows-x86_64.zip https://github.com/dotenvx/releases/blob/main/latest/dotenvx-windows-x86_64.zip?raw=true | |
Expand-Archive -Path dotenvx-windows-x86_64.zip -DestinationPath .\dotenvx | |
- name: verify version | |
run: | | |
$RELEASED_VERSION = .\dotenvx\dotenvx.exe --version | |
$EXPECTED_VERSION = node -p "require('./package.json').version" | |
Write-Output "released version: $RELEASED_VERSION" | |
Write-Output "expected version: $EXPECTED_VERSION" | |
if ($RELEASED_VERSION -ne $EXPECTED_VERSION) { | |
Write-Output "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
} | |
shell: pwsh | |
- name: verify dotenvx run/get | |
run: | | |
"HELLO=Windows" | Out-File -FilePath .env | |
"console.log('Hello ' + process.env.HELLO)" | Out-File -FilePath index.js | |
$EXPECTED_MESSAGE = .\dotenvx\dotenvx.exe run --quiet -- node index.js | |
Write-Output "Expected Message: $EXPECTED_MESSAGE" | |
if ($EXPECTED_MESSAGE -ne "Hello Windows") { | |
Write-Output "postrelease dotenvx run failure: expected 'Hello Windows', got '$EXPECTED_MESSAGE'" | |
exit 1 | |
} | |
$EXPECTED_VALUE = .\dotenvx\dotenvx.exe get HELLO | |
Write-Output "Expected Value: $EXPECTED_VALUE" | |
if ($EXPECTED_VALUE -ne "Windows") { | |
Write-Output "postrelease dotenvx get failure: expected 'Windows', got '$EXPECTED_VALUE'" | |
exit 1 | |
} | |
shell: pwsh | |
- name: verify nested invocations | |
run: | | |
"HELLO=Windows" | Out-File -FilePath .env | |
"console.log('Hello ' + process.env.HELLO)" | Out-File -FilePath index.js | |
$EXPECTED_MESSAGE = .\dotenvx\dotenvx.exe run --quiet -- .\dotenvx\dotenvx.exe run --quiet -- .\dotenvx\dotenvx.exe run --quiet -- node index.js | |
Write-Output "Expected Message: $EXPECTED_MESSAGE" | |
if ($EXPECTED_MESSAGE -ne "Hello Windows") { | |
Write-Output "postrelease dotenvx run failure: expected 'Hello Windows', got '$EXPECTED_MESSAGE'" | |
exit 1 | |
} | |
shell: pwsh | |
postrelease-bunx: | |
needs: confirm-dotenvx-sh | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: verify dotenvx run | |
run: | | |
echo "HELLO=Bun" > .env | |
EXPECTED_VERSION=$(node -p "require('./package.json').version") | |
docker run --rm \ | |
-v $(pwd):/workspace \ | |
-w /workspace \ | |
oven/bun:1.1.25-alpine \ | |
sh -c "bunx @dotenvx/dotenvx@$EXPECTED_VERSION run --overload --quiet -- sh -c 'echo Hello \$HELLO'" | tee output.txt | |
output=$(cat output.txt) | |
if [ "$output" != "Hello Bun" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Bun, got $output" | |
exit 1 | |
fi |