Skip to content

Commit

Permalink
Merge pull request #3 from cyclinder/ci1
Browse files Browse the repository at this point in the history
fix ci1
  • Loading branch information
cyclinder authored Mar 7, 2023
2 parents 4eb545c + 1c82eba commit b6d656c
Showing 1 changed file with 43 additions and 46 deletions.
89 changes: 43 additions & 46 deletions .github/workflows/bin-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
push:
branch:
tags:
- main
- main

permissions: write-all

Expand All @@ -32,52 +32,49 @@ jobs:
name: Binary Build ${{ matrix.go_arch }}
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}

- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Get Upload
id: tag
run: |
if ${{ inputs.ref != '' }} ; then
echo "call by workflow_call"
echo "upload=true" >> $GITHUB_OUTPUT
echo "tag=${{ inputs.ref }}" >> $GITHUB_OUTPUT
elif ${{ inputs.tag != '' }} ; then
echo "call by workflow_call(release push)"
echo "upload=true" >> $GITHUB_OUTPUT
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo "upload=false" >> $GITHUB_OUTPUT
echo "tag=main" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo "upload=false" >> $GITHUB_OUTPUT
echo "tag=dev" >> $GITHUB_OUTPUT
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
fi
- name: Get Upload
id: tag
run: |
if ${{ inputs.ref != '' }} ; then
echo "call by workflow_call(e2e)"
echo "upload=true" >> $GITHUB_OUTPUT
echo "tag=dev" >> $GITHUB_OUTPUT
elif ${{ inputs.tag != '' }} ; then
echo "call by workflow_call(release push)"
echo "upload=true" >> $GITHUB_OUTPUT
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo "upload=false" >> $GITHUB_OUTPUT
echo "tag=main" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo "upload=false" >> $GITHUB_OUTPUT
echo "tag=dev" >> $GITHUB_OUTPUT
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
fi
- name: Build
run: make build ARCH=${{ matrix.go_arch }} GIT_TAG=${{ steps.tag.outputs.tag }}
- name: Build
run:
make build ARCH=${{ matrix.go_arch }} GIT_TAG=${{ steps.tag.outputs.tag }}
if [ "${{ steps.tag.outputs.upload }}" == "true" ]; then
cd ./.tmp/bin && tar -cvzf /home/spider-plugins-linux-${{ matrix.go_arch }}-${{ steps.tag.outputs.tag }}.tar *
fi

- name: Tar Binary Files
if: ${{ steps.tag.outputs.upload == 'true' }}
run: |
sudo mkdir -p /home/plugins
sudo cd ./.tmp/bin
sudo tar -cvzf /home/spider-plugins-linux-${{ matrix.go_arch }}-${{ steps.tag.outputs.tag }}.tar *
- name: Upload Binary artifact
if: ${{ steps.tag.outputs.upload == 'true' }}
uses: actions/[email protected]
with:
name: binary_files
path: /home/spider-plugins-linux-${{ matrix.go_arch }}-${{ steps.tag.outputs.tag }}.tar
retention-days: 1
- name: Upload Binary artifact
if: ${{ steps.tag.outputs.upload == 'true' }}
uses: actions/[email protected]
with:
name: binary_files
path: /home/spider-plugins-linux-${{ matrix.go_arch }}-${{ steps.tag.outputs.tag }}.tar
retention-days: 1

0 comments on commit b6d656c

Please sign in to comment.