Update CI action steps (#814)

This commit is contained in:
Marijan Smetko 2023-03-28 22:44:23 +02:00 committed by GitHub
parent a41c2cc2d3
commit 3514ff2401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 39 deletions

View file

@ -17,16 +17,16 @@ jobs:
steps: steps:
- name: Check Out Repo - name: Check Out Repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v4
with: with:
images: ghcr.io/${{ github.repository_owner }}/atuin images: ghcr.io/${{ github.repository }}
tags: | tags: |
type=ref,event=pr type=ref,event=pr
type=ref,event=branch type=ref,event=branch
@ -35,10 +35,10 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@ -46,7 +46,7 @@ jobs:
- name: Build and push - name: Build and push
id: docker_build id: docker_build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: ./ context: ./
file: ./Dockerfile file: ./Dockerfile

View file

@ -27,7 +27,7 @@ jobs:
- { os: macos-12 , target: aarch64-apple-darwin } - { os: macos-12 , target: aarch64-apple-darwin }
steps: steps:
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install prerequisites - name: Install prerequisites
shell: bash shell: bash
@ -47,10 +47,10 @@ jobs:
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
- name: Install Rust toolchain - name: Install Rust toolchain
uses: actions-rs/toolchain@v1 uses: dtolnay/rust-toolchain@master
with: with:
toolchain: stable toolchain: stable
target: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
override: true override: true
profile: minimal # minimal component installation (ie, no documentation) profile: minimal # minimal component installation (ie, no documentation)
@ -65,11 +65,7 @@ jobs:
rustc -V rustc -V
- name: Build - name: Build
uses: actions-rs/cargo@v1 run: cargo build --locked --release --target=${{ matrix.job.target }}
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --locked --release --target=${{ matrix.job.target }}
- name: Strip debug information from executable - name: Strip debug information from executable
id: strip id: strip
@ -105,8 +101,8 @@ jobs:
fi fi
# Let subsequent steps know where to find the (stripped) bin # Let subsequent steps know where to find the (stripped) bin
echo ::set-output name=BIN_PATH::${BIN_PATH} echo "BIN_PATH=${BIN_PATH}" >> "$GITHUB_OUTPUT"
echo ::set-output name=BIN_NAME::${BIN_NAME} echo "BIN_NAME=${BIN_NAME}" >> "$GITHUB_OUTPUT"
- name: Create tarball - name: Create tarball
id: package id: package
@ -115,7 +111,7 @@ jobs:
PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac; PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }} PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }}
PKG_NAME=${PKG_BASENAME}${PKG_suffix} PKG_NAME=${PKG_BASENAME}${PKG_suffix}
echo ::set-output name=PKG_NAME::${PKG_NAME} echo "PKG_NAME=${PKG_NAME}" >> "$GITHUB_OUTPUT"
PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package" PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package"
ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"
@ -142,7 +138,7 @@ jobs:
popd >/dev/null popd >/dev/null
# Let subsequent steps know where to find the compressed package # Let subsequent steps know where to find the compressed package
echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}" echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> "$GITHUB_OUTPUT"
- name: Create Debian package - name: Create Debian package
id: debian-package id: debian-package
@ -164,8 +160,8 @@ jobs:
DPKG_PATH="target/debian/${PKG_BASENAME}.deb" DPKG_PATH="target/debian/${PKG_BASENAME}.deb"
DPKG_PATH="target/debian/${DPKG_NAME}" DPKG_PATH="target/debian/${DPKG_NAME}"
echo ::set-output name=DPKG_NAME::${DPKG_NAME} echo DPKG_NAME=${DPKG_NAME} >> $GITHUB_OUTPUT
echo ::set-output name=DPKG_PATH::${DPKG_PATH} echo DPKG_PATH=${DPKG_PATH} >> $GITHUB_OUTPUT
- name: "Artifact upload: tarball" - name: "Artifact upload: tarball"
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
@ -185,7 +181,7 @@ jobs:
shell: bash shell: bash
run: | run: |
unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
echo ::set-output name=IS_RELEASE::${IS_RELEASE} echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
- name: Publish archives and packages - name: Publish archives and packages
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1

View file

@ -14,15 +14,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install rust - name: Install rust
uses: actions-rs/toolchain@v1 uses: dtolnay/rust-toolchain@master
with: with:
toolchain: stable toolchain: stable
override: true
- uses: actions/cache@v2 - uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@ -46,21 +45,20 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install rust - name: Install rust
uses: actions-rs/toolchain@v1 uses: dtolnay/rust-toolchain@master
with: with:
toolchain: stable toolchain: stable
override: true
- uses: actions/cache@v2 - uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
target target
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }} key: ${ runner.os }-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo test - name: Run cargo test
run: cargo test --all-features --workspace run: cargo test --all-features --workspace
@ -81,16 +79,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install latest rust - name: Install latest rust
uses: actions-rs/toolchain@v1 uses: dtolnay/rust-toolchain@master
with: with:
toolchain: stable toolchain: stable
override: true
components: clippy components: clippy
- uses: actions/cache@v2 - uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@ -105,13 +102,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install latest rust - name: Install latest rust
uses: actions-rs/toolchain@v1 uses: dtolnay/rust-toolchain@master
with: with:
toolchain: stable toolchain: stable
override: true
components: rustfmt components: rustfmt
- name: Format - name: Format

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run shellcheck - name: Run shellcheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
env: env: