Skip to content

Commit

Permalink
Merge pull request #7 from michimani/feature/6/update-gh
Browse files Browse the repository at this point in the history
update github action #6
  • Loading branch information
michimani authored Dec 5, 2022
2 parents aad0b4a + a2260aa commit 9745bdd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 50 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/onlytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
go-version: 1.19

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

- name: Get dependencies
run: go install
Expand All @@ -30,4 +30,21 @@ jobs:
run: go test -race -coverprofile="coverage.txt" -covermode=atomic github.com/michimani/invocation-history-extension/... -shuffle=on

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3

build-test:
name: Build test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Check out code
uses: actions/checkout@v3

- name: Build extension
run: |
go version
make build
61 changes: 13 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,31 @@ jobs:
- name: Test code
run: go test github.com/michimani/aws-lambda-api-go/... -shuffle=on

setup-release:
name: Setup release
create-release:
name: Build extension
needs: test
runs-on: ubuntu-latest
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Get url to upload to release from output
env:
url: ${{ steps.create_release.outputs.upload_url }}
run: |
mkdir artifact
echo $url > artifact/url.txt
- name: Upload artifact to share url with other jobs
uses: actions/upload-artifact@v1
with:
name: artifact
path: artifact/url.txt

release-code:
name: Release Source Code
needs: setup-release
runs-on: ubuntu-latest
steps:
- name: Download artifact to get url to upload to release
uses: actions/download-artifact@v2
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
name: artifact

- name: Get url to upload to release from artifact
id: get_url
run: |
pwd
ls -al
url=$(cat url.txt)
echo "##[set-output name=upload_url;]$url"
go-version: 1.19

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

- name: Build extension and zip
- name: Build extension and zip it
run: |
make build
cd bin && zip -r extension.zip extensions/
- name: Upload release asset
uses: actions/upload-release-asset@v1.0.2
- name: Create new release with asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_url.outputs.upload_url }}
asset_path: bin/extension.zip
asset_name: extension.zip
asset_content_type: application/zip
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
files: bin/extension.zip

0 comments on commit 9745bdd

Please sign in to comment.