Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

add tags to release.yml #4

Merged
merged 27 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8af524b
remove tags step in release.yml
itsmostafa Jan 30, 2023
8700dd4
fix github token
itsmostafa Jan 30, 2023
80e8333
fix github token
itsmostafa Jan 30, 2023
a8f3ea1
Merge branch 'develop' into feature/add-release-actions
itsmostafa Jan 30, 2023
8b67123
add caching step
itsmostafa Jan 30, 2023
c567817
add goreleaser.yml
itsmostafa Jan 30, 2023
e91763b
add push on tags
itsmostafa Jan 30, 2023
e788ff6
remove gorelease for alternative solution
itsmostafa Jan 30, 2023
ede4bb9
remove gorelease for alternative solution
itsmostafa Jan 30, 2023
743c0e7
comment out tags
itsmostafa Jan 30, 2023
44eb8c3
update release steps
itsmostafa Jan 30, 2023
4430696
add back build name
itsmostafa Jan 30, 2023
a8109e7
fix build app step
itsmostafa Jan 30, 2023
c1b5387
fix release step
itsmostafa Jan 30, 2023
1d1c6d1
update work dir for release
itsmostafa Jan 30, 2023
548c52f
update release step
itsmostafa Jan 30, 2023
870785e
fixes
itsmostafa Jan 30, 2023
e79d298
fix build step
itsmostafa Jan 30, 2023
fae4279
fix release step
itsmostafa Jan 30, 2023
b399550
revert build.yml
itsmostafa Jan 31, 2023
c202607
fix: github-script step in release.yml
itsmostafa Jan 31, 2023
aa5ba05
add auto-tag step to release
itsmostafa Feb 1, 2023
6724790
add autotag step to release
itsmostafa Feb 1, 2023
768611a
add new version for teesting
itsmostafa Feb 1, 2023
b8c277d
export-ignore all files
itsmostafa Feb 1, 2023
c62fa9e
fix: typo in build names
itsmostafa Feb 1, 2023
5d12d6b
limit releases to merges to develop
itsmostafa Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 109 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,121 @@ name: release

on:
push:
tags:
- "*" # triggers only if push new tag version
branches:
- develop

env:
RUN_TMATE: ${{ secrets.RUN_TMATE }}

jobs:
build:
name: GoReleaser build
name: go-build
runs-on: ubuntu-latest

strategy:
matrix:
bin:
- pca-linux-amd64
- pca-linux-arm64
- pca-osx-amd64
- pca-osx-arm64
include:
- bin: pca-linux-amd64
goos: linux
arch: amd64
- os: pca-linux-arm64
goos: linux
arch: arm64
- bin: pca-osx-amd64
goos: darwin
arch: amd64
- bin: pca-osx-arm64
goos: darwin
arch: arm64
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- uses: actions/checkout@v3
- id: setup-go
uses: actions/setup-go@v3
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Set up go
uses: actions/setup-go@v2
go-version: "1.19"
cache: true
- name: Lookup Go cache directory
id: go-cache
run: |
echo "dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
env:
BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
go${{ steps.setup-go.outputs.go-version }}-"
with:
go-version: 1.19
id: go

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@master
path: |
${{ steps.go-cache.outputs.dir }}
key: "${{ env.BASE_CACHE_KEY }}\
${{ hashFiles('go.mod') }}-\
${{ hashFiles('go.sum') }}"
restore-keys: |
${{ env.BASE_CACHE_KEY }}
- name: Build ${{ matrix.os }}
run: go build -o ${{ matrix.bin }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.arch }}
- name: Upload to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: ${{ matrix.bin }}
release:
name: go-release
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download to artifacts
uses: actions/download-artifact@v3
with:
path: bin
- name: Set Tag Version
run: echo "VERSION=$(cat ./VERSION)" >> $GITHUB_ENV
- name: Create Release
uses: actions/github-script@v6
with:
version: latest
args: release --rm-dist
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: `con-pca-tasks ${process.env.VERSION}`,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.VERSION,
});
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}
- name: Upload Archives to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOAD_URL: ${{ env.RELEASE_UPLOAD_URL }}
API_HEADER: "Accept: application/vnd.github.v3+json"
AUTH_HEADER: "Authorization: token ${{ secrets.GITHUB_TOKEN }}"
run: |
UPLOAD_URL=$(echo -n $UPLOAD_URL | sed s/\{.*//g)
for each in bin/*
do
for FILE in $each/*
do
echo "Uploading ${FILE}";
curl \
-H "${API_HEADER}" \
-H "${AUTH_HEADER}" \
-H "Content-Type: $(file -b --mime-type ${FILE})" \
--data-binary "@${FILE}" \
"${UPLOAD_URL}?name=$(basename ${FILE})";
done
done
- name: Setup tmate debug session
uses: mxschmitt/action-tmate@v3
if: env.RUN_TMATE
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
# Test binary, built with `go test -c`
*.test

## Environment variables ##
.env

## MacOS ##
.DS_Store

## Python ##
__pycache__
.mypy_cache
.python-version
.venv

## Environment variables ##
.env
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.0.1