Skip to content

Commit

Permalink
build: update upload-artifact and download-artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Jan 25, 2024
1 parent 0c390a2 commit 159bcc0
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Use https://app.stepsecurity.io/ to improve workflow security
name: Create Release

on:
push:
tags: [ "v*.*.*" ]

permissions:
contents: read

jobs:
testing:
name: Testing
Expand All @@ -13,18 +17,20 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: stable
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Check
run: make check

create_release:
permissions:
contents: write
name: Create Release
needs: [testing]
runs-on: ubuntu-latest
Expand All @@ -43,12 +49,15 @@ jobs:
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt

- name: Save Release URL File for publish
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: release_url
path: release_url.txt
retention-days: 1

publish:
permissions:
contents: write
name: Publish
needs: [testing, create_release]
runs-on: ${{ matrix.os }}
Expand All @@ -57,18 +66,19 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: stable
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Load Release URL File from release job
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: release_url
path: release_url.txt

- name: Distribute
run: make dist
Expand All @@ -77,13 +87,14 @@ jobs:
id: get_release_info
shell: bash
run: |
value=`cat release_url/release_url.txt`
ls -lR
value=`cat release_url.txt`
echo ::set-output name=upload_url::$value
env:
TAG_REF_NAME: ${{ github.ref }}
REPOSITORY_NAME: ${{ github.repository }}

- name: Upload Linux Binary
- name: Upload Linux Server Binary
if: runner.os == 'Linux'
uses: actions/upload-release-asset@v1
env:
Expand All @@ -94,7 +105,7 @@ jobs:
asset_name: metro2-linux-amd64
asset_content_type: application/octet-stream

- name: Upload macOS Binary
- name: Upload macOS Server Binary
if: runner.os == 'macOS'
uses: actions/upload-release-asset@v1
env:
Expand All @@ -105,7 +116,7 @@ jobs:
asset_name: metro2-darwin-amd64
asset_content_type: application/octet-stream

- name: Upload Windows Binary
- name: Upload Windows Server Binary
if: runner.os == 'Windows'
uses: actions/upload-release-asset@v1
env:
Expand All @@ -122,13 +133,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: stable
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Docker
run: make docker
Expand Down

0 comments on commit 159bcc0

Please sign in to comment.