Skip to content

Commit e67ca7a

Browse files
aewedaaesedepece
authored andcommitted
ci: update & refactor all actions
1 parent ff0eae4 commit e67ca7a

File tree

8 files changed

+188
-144
lines changed

8 files changed

+188
-144
lines changed

.github/actions/build-helper/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ runs:
1414
run: docker build -t witnet-rust/${{ inputs.imagename }}:latest -f ./docker/cross-compilation/${{ inputs.imagename }}/Dockerfile ./docker/cross-compilation/
1515

1616
- name: Upload image
17-
uses: ishworkh/docker-image-artifact-upload@v1
17+
uses: ishworkh/container-image-artifact-upload@v2.0.0
1818
with:
1919
image: "witnet-rust/${{ inputs.imagename }}:latest"

.github/actions/build-linux/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ runs:
1111
steps:
1212
# Download Helper Image built in the previous jobs
1313
- name: Downloading helper Image
14-
uses: ishworkh/docker-image-artifact-download@v1
14+
uses: ishworkh/container-image-artifact-download@v2.0.0
1515
with:
1616
image: "witnet-rust/${{ inputs.target }}:latest"
1717

18-
# Export Vars
19-
- shell: bash
18+
- name: Export Vars
19+
shell: bash
2020
run: |
2121
echo PWD=`pwd` >> $GITHUB_ENV
2222
echo TARGET=${{ inputs.target }} >> $GITHUB_ENV
2323
24-
# Run Binary Build
25-
- shell: bash
24+
- name: Build Binary
25+
shell: bash
2626
run: docker run -v `pwd`:/project:ro -v `pwd`/target:/target -v ~/.cargo:/root/.cargo -w /project -i witnet-rust/$TARGET bash -c "cargo build --release --target=$TARGET --target-dir=/target -p witnet -p witnet_toolkit"
2727

28-
# Show Directory listing
29-
- shell: bash
28+
- name: List Directory
29+
shell: bash
3030
run: ls -lsa ./target/${{ inputs.target }}/release

.github/actions/download-releases/action.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ description: "Download All releases artifacted from the previous jobs & Signs"
44
runs:
55
using: "composite"
66
steps:
7-
# Make Directory
8-
- shell: bash
7+
- name: Create Release Directory
8+
shell: bash
99
run: mkdir release
1010

11-
# Download Genesis Block
12-
- shell: bash
11+
- name: Download Gensis Block
12+
shell: bash
1313
run: |
1414
curl "https://raw.githubusercontent.com/witnet/genesis_block/master/latest/genesis_block.json" -o genesis_block.json
1515
cp genesis_block.json release/
1616
cp witnet.toml release/
1717
1818
# Download & Hash Releases
19-
# Macos
20-
- uses: actions/download-artifact@v3
19+
- name: Download MacOS Build
20+
uses: actions/download-artifact@v4
2121
with:
2222
name: macos-release
2323
path: all-releases/macos/
@@ -28,8 +28,8 @@ runs:
2828
cp witnet.toml ./all-releases/macos/
2929
mv all-releases/macos/witnet_toolkit release/witnet_toolkit-x86_64-apple-darwin
3030
31-
# Windows
32-
- uses: actions/download-artifact@v3
31+
- name: Download Windows Build
32+
uses: actions/download-artifact@v4
3333
with:
3434
name: windows-release
3535
path: all-releases/windows/
@@ -40,8 +40,8 @@ runs:
4040
cp witnet.toml ./all-releases/windows/
4141
mv all-releases/windows/witnet_toolkit.exe release/witnet_toolkit-x86_64-pc-windows-msvc.exe
4242
43-
# x86_64
44-
- uses: actions/download-artifact@v3
43+
- name: Download x86_64 Build
44+
uses: actions/download-artifact@v4
4545
with:
4646
name: x86_64-release
4747
path: all-releases/x86_64/
@@ -52,8 +52,8 @@ runs:
5252
cp witnet.toml ./all-releases/x86_64/
5353
mv all-releases/x86_64/witnet_toolkit release/witnet_toolkit-x86_64-unknown-linux-gnu
5454
55-
# armv7
56-
- uses: actions/download-artifact@v3
55+
- name: Download armv7 Build
56+
uses: actions/download-artifact@v4
5757
with:
5858
name: armv7-release
5959
path: all-releases/armv7/
@@ -64,8 +64,8 @@ runs:
6464
cp witnet.toml ./all-releases/armv7/
6565
mv all-releases/armv7/witnet_toolkit release/witnet_toolkit-armv7-unknown-linux-gnueabihf
6666
67-
# aarch64
68-
- uses: actions/download-artifact@v3
67+
- name: Download aarch64 Build
68+
uses: actions/download-artifact@v4
6969
with:
7070
name: aarch64-release
7171
path: all-releases/aarch64/
@@ -76,17 +76,17 @@ runs:
7676
cp witnet.toml ./all-releases/aarch64/
7777
mv all-releases/aarch64/witnet_toolkit release/witnet_toolkit-aarch64-unknown-linux-gnu
7878
79-
# tar Releases
80-
- shell: bash
79+
- name: Tar Releases
80+
shell: bash
8181
run: |
8282
tar -czvf release/witnet-${{github.ref_name}}-x86_64-apple-darwin.tar.gz -C all-releases/macos/ .
8383
tar -czvf release/witnet-${{github.ref_name}}-x86_64-pc-windows-msvc.tar.gz -C all-releases/windows/ .
8484
tar -czvf release/witnet-${{github.ref_name}}-x86_64-unknown-linux-gnu.tar.gz -C all-releases/x86_64/ .
8585
tar -czvf release/witnet-${{github.ref_name}}-armv7-unknown-linux-gnueabihf.tar.gz -C all-releases/armv7/ .
8686
tar -czvf release/witnet-${{github.ref_name}}-aarch64-unknown-linux-gnu.tar.gz -C all-releases/aarch64/ .
8787
88-
# Sign Tars
89-
- shell: bash
88+
- name: Sign Tars
89+
shell: bash
9090
run: |
9191
cd release
9292
sha256sum genesis_block.json >>SHA256SUMS

.github/actions/versions-match/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ runs:
1111
using: "composite"
1212
steps:
1313
# Perform the version matching
14-
- shell: bash
14+
- name: Verify Matching Versions
15+
shell: bash
1516
run: |
1617
echo "Checking version of subcrate \"${{ inputs.subcrate }}\""
17-
MAIN_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]\.[0-9])"/\1/p' ./Cargo.toml | head -1)
18-
SUBCRATE_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]\.[0-9])"/\1/p' ./${{ inputs.subcrate }}/Cargo.toml | head -1)
19-
if [[ "$SUBCRATE_VERSION" != "$MAIN_VERSION" ]]; \
20-
then \
21-
echo "Version of subcrate \"${{ inputs.subcrate }}\" ($SUBCRATE_VERSION) does not match that of main crate ($MAIN_VERSION)"; \
22-
exit 10; \
18+
MAIN_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)"/\1/p' ./Cargo.toml | head -1)
19+
SUBCRATE_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)"/\1/p' ./${{ inputs.subcrate }}/Cargo.toml | head -1)
20+
if [[ "$SUBCRATE_VERSION" != "$MAIN_VERSION" ]]; then
21+
echo "Version of subcrate \"${{ inputs.subcrate }}\" ($SUBCRATE_VERSION) does not match that of main crate ($MAIN_VERSION)"
22+
exit 10
2323
fi

.github/workflows/bridge.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ on:
1212
required: false
1313
default: true
1414

15+
env:
16+
CARGO_TERM_COLOR: always
17+
1518
jobs:
1619
Bridge:
1720
runs-on: ubuntu-latest
1821
environment: tags
1922
if: ${{ github.event.workflow_run.conclusion == 'success' || inputs.force }}
2023
steps:
21-
- uses: actions/checkout@v3
24+
- name: Checkout
25+
uses: actions/checkout@v4
2226

2327
- name: Install Protobuf
2428
run: |
@@ -33,26 +37,36 @@ jobs:
3337
run: |
3438
cp target/release/witnet-centralized-ethereum-bridge ./
3539
36-
- name: Set Version
40+
- name: Check Pre-release
3741
run: |
38-
echo VERNUM=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]\.[0-9])"/\1/p' ./bridges/centralized-ethereum/Cargo.toml | head -1) >> $GITHUB_ENV
42+
TAG=${{ github.ref_name }}
43+
if [[ "$TAG" =~ - ]]; then
44+
echo "prerelease=true" >> $GITHUB_ENV
45+
else
46+
echo "prerelease=false" >> $GITHUB_ENV
47+
fi
3948
40-
- name: Build docker Image
49+
- name: Set Version
4150
run: |
42-
docker build -t witnet/witnet-centralized-ethereum-bridge:"$VERNUM" -f ./docker/bridge/Dockerfile .
43-
docker build -t witnet/witnet-centralized-ethereum-bridge:latest -f ./docker/bridge/Dockerfile .
44-
docker image ls
45-
51+
echo VERNUM=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?)"/\1/p' ./bridges/centralized-ethereum/Cargo.toml | head -1) >> $GITHUB_ENV
52+
4653
- name: Login to Docker hub Registry
47-
uses: docker/login-action@v2
54+
uses: docker/login-action@v3
4855
with:
4956
username: ${{ secrets.DOCKER_USERNAME }}
5057
password: ${{ secrets.DOCKER_PASSWORD }}
5158

52-
- name: Push Image
59+
- name: Build & Push Tag Image
5360
run: |
61+
docker build -t witnet/witnet-centralized-ethereum-bridge:"$VERNUM" -f ./docker/bridge/Dockerfile .
5462
docker push witnet/witnet-centralized-ethereum-bridge:"$VERNUM"
63+
64+
- name: Build & Push Latest if not Pre-Release
65+
run: |
66+
docker build -t witnet/witnet-centralized-ethereum-bridge:latest -f ./docker/bridge/Dockerfile .
5567
docker push witnet/witnet-centralized-ethereum-bridge:latest
68+
if: env.prerelease == 'false'
69+
5670

5771
Failure:
5872
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)