Skip to content

Commit

Permalink
Fix attempt 4
Browse files Browse the repository at this point in the history
  • Loading branch information
xarantolus committed Jan 14, 2023
1 parent a49dc88 commit 9f93f92
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ jobs:
- name: Check out repository
uses: actions/checkout@v3

- name: Pull latest tags
run: git fetch --prune --unshallow --tags

- name: Check if tag to be created does not yet exist
run: |
TAG=v$(awk '$1 == "version" {print $3}' Cargo.toml | head | tr -d "\"" | head -n1)
if git rev-parse $TAG >/dev/null 2>&1; then
echo "Tag $TAG already exists"
exit 1
fi
echo "TAG=$TAG" >> $GITHUB_ENV
continue-on-error: true

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand All @@ -42,12 +29,6 @@ jobs:
- name: Run tests
run: make precommit

- name: Set tag name
id: tag
run: |
echo "tag=${{ env.TAG }}" >> $GITHUB_ENV
if: env.TAG

build-windows:
name: "Build for Windows"
runs-on: windows-latest
Expand Down Expand Up @@ -127,32 +108,51 @@ jobs:
name: Release
runs-on: ubuntu-latest
needs: [test, build-windows, build-linux, build-wasm]
if: needs.test.outputs.tag
steps:
# Download previously built artifacts
- name: Check out repository
uses: actions/checkout@v3

- name: Pull latest tags
run: git fetch --prune --unshallow --tags

- name: Check if tag to be created does not yet exist
run: |
TAG=v$(awk '$1 == "version" {print $3}' Cargo.toml | head | tr -d "\"" | head -n1)
if git rev-parse $TAG >/dev/null 2>&1; then
echo "Tag $TAG already exists"
exit 1
fi
echo "TAG=$TAG" >> $GITHUB_ENV
continue-on-error: true

- name: Download Windows executable
uses: actions/download-artifact@v2
with:
name: ax.exe
if: env.TAG

- name: Download Linux executable
uses: actions/download-artifact@v2
with:
name: ax
if: env.TAG

- name: Download WebAssembly module
uses: actions/download-artifact@v2
with:
name: pkg
if: env.TAG

- name: Log in to NPM
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
if: env.TAG

- name: Publish to NPM
working-directory: pkg
run: npm publish
if: env.TAG

- name: GitHub Release
uses: softprops/action-gh-release@v1
Expand All @@ -165,3 +165,4 @@ jobs:
draft: true
fail_on_unmatched_files: true
generate_release_notes: true
if: env.TAG

0 comments on commit 9f93f92

Please sign in to comment.