fix: broken CI due to deprecated github action artifact usage #345
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
# GENERATED BY ./ci.generate.ts -- DO NOT DIRECTLY EDIT | |
name: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: "${{ matrix.config.target }}" | |
runs-on: "${{ matrix.config.os }}" | |
strategy: | |
matrix: | |
config: | |
- os: macos-13 | |
run_tests: "true" | |
cross: "false" | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
run_tests: "true" | |
cross: "false" | |
target: aarch64-apple-darwin | |
- os: windows-latest | |
run_tests: "true" | |
cross: "false" | |
target: x86_64-pc-windows-msvc | |
- os: ubuntu-20.04 | |
run_tests: "true" | |
cross: "false" | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-20.04 | |
run_tests: "false" | |
cross: "true" | |
target: aarch64-unknown-linux-gnu | |
outputs: | |
ZIP_CHECKSUM_X86_64_APPLE_DARWIN: "${{steps.pre_release_x86_64_apple_darwin.outputs.ZIP_CHECKSUM}}" | |
ZIP_CHECKSUM_AARCH64_APPLE_DARWIN: "${{steps.pre_release_aarch64_apple_darwin.outputs.ZIP_CHECKSUM}}" | |
ZIP_CHECKSUM_X86_64_PC_WINDOWS_MSVC: "${{steps.pre_release_x86_64_pc_windows_msvc.outputs.ZIP_CHECKSUM}}" | |
ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_GNU: "${{steps.pre_release_x86_64_unknown_linux_gnu.outputs.ZIP_CHECKSUM}}" | |
ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_GNU: "${{steps.pre_release_aarch64_unknown_linux_gnu.outputs.ZIP_CHECKSUM}}" | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUST_BACKTRACE: full | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dsherret/rust-toolchain-file@v1 | |
- name: Cache cargo | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "v3-${{matrix.config.target}}" | |
save-if: "${{ github.ref == 'refs/heads/main' }}" | |
- name: Setup Rust (aarch64-apple-darwin) | |
if: matrix.config.target == 'aarch64-apple-darwin' | |
run: rustup target add aarch64-apple-darwin | |
- uses: denoland/setup-deno@v1 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: npm install | |
run: cd js/node && npm ci | |
- name: Setup cross | |
if: matrix.config.cross == 'true' | |
run: |- | |
deno task build | |
cargo install cross --git https://github.com/cross-rs/cross --rev 44011c8854cb2eaac83b173cc323220ccdff18ea | |
- name: Build (Debug) | |
if: "matrix.config.cross != 'true' && !startsWith(github.ref, 'refs/tags/')" | |
run: "cargo build --locked --all-targets --target ${{matrix.config.target}}" | |
- name: Build release | |
if: "matrix.config.cross != 'true' && startsWith(github.ref, 'refs/tags/')" | |
run: "cargo build --locked --all-targets --target ${{matrix.config.target}} --release" | |
- name: Build cross (Debug) | |
if: "matrix.config.cross == 'true' && !startsWith(github.ref, 'refs/tags/')" | |
run: "cross build --locked --target ${{matrix.config.target}}" | |
- name: Build cross (Release) | |
if: "matrix.config.cross == 'true' && startsWith(github.ref, 'refs/tags/')" | |
run: "cross build --locked --target ${{matrix.config.target}} --release" | |
- name: Lint | |
if: "!startsWith(github.ref, 'refs/tags/') && matrix.config.target == 'x86_64-unknown-linux-gnu'" | |
run: cargo clippy | |
- name: Test (Debug) | |
if: "matrix.config.run_tests == 'true' && !startsWith(github.ref, 'refs/tags/')" | |
run: cargo test --locked --all-features | |
- name: Test (Release) | |
if: "matrix.config.run_tests == 'true' && startsWith(github.ref, 'refs/tags/')" | |
run: cargo test --locked --all-features --release | |
- name: Pre-release (x86_64-apple-darwin) | |
id: pre_release_x86_64_apple_darwin | |
if: "matrix.config.target == 'x86_64-apple-darwin' && startsWith(github.ref, 'refs/tags/')" | |
run: |- | |
cd target/x86_64-apple-darwin/release | |
zip -r dprint-plugin-prettier-x86_64-apple-darwin.zip dprint-plugin-prettier | |
echo "ZIP_CHECKSUM=$(shasum -a 256 dprint-plugin-prettier-x86_64-apple-darwin.zip | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Pre-release (aarch64-apple-darwin) | |
id: pre_release_aarch64_apple_darwin | |
if: "matrix.config.target == 'aarch64-apple-darwin' && startsWith(github.ref, 'refs/tags/')" | |
run: |- | |
cd target/aarch64-apple-darwin/release | |
zip -r dprint-plugin-prettier-aarch64-apple-darwin.zip dprint-plugin-prettier | |
echo "ZIP_CHECKSUM=$(shasum -a 256 dprint-plugin-prettier-aarch64-apple-darwin.zip | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Pre-release (x86_64-pc-windows-msvc) | |
id: pre_release_x86_64_pc_windows_msvc | |
if: "matrix.config.target == 'x86_64-pc-windows-msvc' && startsWith(github.ref, 'refs/tags/')" | |
run: |- | |
Compress-Archive -CompressionLevel Optimal -Force -Path target/x86_64-pc-windows-msvc/release/dprint-plugin-prettier.exe -DestinationPath target/x86_64-pc-windows-msvc/release/dprint-plugin-prettier-x86_64-pc-windows-msvc.zip | |
echo "ZIP_CHECKSUM=$(shasum -a 256 target/x86_64-pc-windows-msvc/release/dprint-plugin-prettier-x86_64-pc-windows-msvc.zip | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Pre-release (x86_64-unknown-linux-gnu) | |
id: pre_release_x86_64_unknown_linux_gnu | |
if: "matrix.config.target == 'x86_64-unknown-linux-gnu' && startsWith(github.ref, 'refs/tags/')" | |
run: |- | |
cd target/x86_64-unknown-linux-gnu/release | |
zip -r dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip dprint-plugin-prettier | |
echo "ZIP_CHECKSUM=$(shasum -a 256 dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Pre-release (aarch64-unknown-linux-gnu) | |
id: pre_release_aarch64_unknown_linux_gnu | |
if: "matrix.config.target == 'aarch64-unknown-linux-gnu' && startsWith(github.ref, 'refs/tags/')" | |
run: |- | |
cd target/aarch64-unknown-linux-gnu/release | |
zip -r dprint-plugin-prettier-aarch64-unknown-linux-gnu.zip dprint-plugin-prettier | |
echo "ZIP_CHECKSUM=$(shasum -a 256 dprint-plugin-prettier-aarch64-unknown-linux-gnu.zip | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Upload artifacts (x86_64-apple-darwin) | |
if: "matrix.config.target == 'x86_64-apple-darwin' && startsWith(github.ref, 'refs/tags/')" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: x86_64-apple-darwin-artifacts | |
path: target/x86_64-apple-darwin/release/dprint-plugin-prettier-x86_64-apple-darwin.zip | |
- name: Upload artifacts (aarch64-apple-darwin) | |
if: "matrix.config.target == 'aarch64-apple-darwin' && startsWith(github.ref, 'refs/tags/')" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aarch64-apple-darwin-artifacts | |
path: target/aarch64-apple-darwin/release/dprint-plugin-prettier-aarch64-apple-darwin.zip | |
- name: Upload artifacts (x86_64-pc-windows-msvc) | |
if: "matrix.config.target == 'x86_64-pc-windows-msvc' && startsWith(github.ref, 'refs/tags/')" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: x86_64-pc-windows-msvc-artifacts | |
path: target/x86_64-pc-windows-msvc/release/dprint-plugin-prettier-x86_64-pc-windows-msvc.zip | |
- name: Upload artifacts (x86_64-unknown-linux-gnu) | |
if: "matrix.config.target == 'x86_64-unknown-linux-gnu' && startsWith(github.ref, 'refs/tags/')" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: x86_64-unknown-linux-gnu-artifacts | |
path: target/x86_64-unknown-linux-gnu/release/dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip | |
- name: Upload artifacts (aarch64-unknown-linux-gnu) | |
if: "matrix.config.target == 'aarch64-unknown-linux-gnu' && startsWith(github.ref, 'refs/tags/')" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aarch64-unknown-linux-gnu-artifacts | |
path: target/aarch64-unknown-linux-gnu/release/dprint-plugin-prettier-aarch64-unknown-linux-gnu.zip | |
draft_release: | |
name: draft_release | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- uses: denoland/setup-deno@v1 | |
- name: Move downloaded artifacts to root directory | |
run: |- | |
mv x86_64-apple-darwin-artifacts/dprint-plugin-prettier-x86_64-apple-darwin.zip . | |
mv aarch64-apple-darwin-artifacts/dprint-plugin-prettier-aarch64-apple-darwin.zip . | |
mv x86_64-pc-windows-msvc-artifacts/dprint-plugin-prettier-x86_64-pc-windows-msvc.zip . | |
mv x86_64-unknown-linux-gnu-artifacts/dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip . | |
mv aarch64-unknown-linux-gnu-artifacts/dprint-plugin-prettier-aarch64-unknown-linux-gnu.zip . | |
- name: Output checksums | |
run: |- | |
echo "dprint-plugin-prettier-x86_64-apple-darwin.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_APPLE_DARWIN}}" | |
echo "dprint-plugin-prettier-aarch64-apple-darwin.zip: ${{needs.build.outputs.ZIP_CHECKSUM_AARCH64_APPLE_DARWIN}}" | |
echo "dprint-plugin-prettier-x86_64-pc-windows-msvc.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_PC_WINDOWS_MSVC}}" | |
echo "dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_GNU}}" | |
echo "dprint-plugin-prettier-aarch64-unknown-linux-gnu.zip: ${{needs.build.outputs.ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_GNU}}" | |
- name: Create plugin file | |
run: deno run -A scripts/create_plugin_file.ts | |
- name: Get tag version | |
id: get_tag_version | |
run: 'echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT' | |
- name: Get plugin file checksum | |
id: get_plugin_file_checksum | |
run: 'echo "CHECKSUM=$(shasum -a 256 plugin.json | awk ''{print $1}'')" >> $GITHUB_OUTPUT' | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
with: | |
files: |- | |
dprint-plugin-prettier-x86_64-apple-darwin.zip | |
dprint-plugin-prettier-aarch64-apple-darwin.zip | |
dprint-plugin-prettier-x86_64-pc-windows-msvc.zip | |
dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip | |
dprint-plugin-prettier-aarch64-unknown-linux-gnu.zip | |
plugin.json | |
body: | | |
## Install | |
Dependencies: | |
- Install dprint's CLI >= 0.40.0 | |
In a dprint configuration file: | |
1. Specify the plugin url and checksum in the `"plugins"` array or run `dprint config add prettier`: | |
```jsonc | |
{ | |
// etc... | |
"plugins": [ | |
// ...add other dprint plugins here that you want to take precedence over prettier... | |
"https://plugins.dprint.dev/prettier-${{ steps.get_tag_version.outputs.TAG_VERSION }}.json@${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }}" | |
] | |
} | |
``` | |
2. Add a `"prettier"` configuration property if desired. | |
```jsonc | |
{ | |
// ...etc... | |
"prettier": { | |
"trailingComma": "all", | |
"singleQuote": true, | |
"proseWrap": "always" | |
} | |
} | |
``` | |
draft: false |