fix: updated dependencies (#117) #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release to Production | |
on: | |
push: | |
branches: [ main ] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
jobs: | |
next-version: | |
name: Next Version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.dependencies.outputs.version }} | |
steps: | |
- name: "Check out code into the Go module directory" | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: "Get dependencies" | |
id: dependencies | |
run: | | |
npm ci | |
npx semantic-release --dry-run | |
cat VERSION.env | |
source VERSION.env | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
darwin-amd64: | |
name: darwin-amd64 | |
if: ${{ needs.next-version.outputs.version != ''}} | |
needs: ["next-version"] | |
runs-on: ubuntu-latest | |
env: | |
GOARCH: amd64 | |
GOOS: darwin | |
steps: | |
- name: "Check out code into the Go module directory" | |
uses: actions/checkout@v3 | |
- id: go | |
name: "Set up Go 1.21" | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: create | |
run: | | |
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt | |
go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
path: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
darwin-arm64: | |
name: darwin-arm64 | |
if: ${{ needs.next-version.outputs.version != ''}} | |
needs: ["next-version"] | |
runs-on: ubuntu-latest | |
env: | |
GOARCH: arm64 | |
GOOS: darwin | |
steps: | |
- name: "Check out code into the Go module directory" | |
uses: actions/checkout@v3 | |
- id: go | |
name: "Set up Go 1.21" | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- | |
name: create | |
run: | | |
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt | |
go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
path: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
linux-386: | |
name: linux-386 | |
if: ${{ needs.next-version.outputs.version != ''}} | |
needs: ["next-version"] | |
runs-on: ubuntu-latest | |
env: | |
GOARCH: "386" | |
GOOS: linux | |
steps: | |
- name: "Check out code into the Go module directory" | |
uses: actions/checkout@v3 | |
- id: go | |
name: "Set up Go 1.21" | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- | |
name: create | |
run: | | |
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt | |
go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
path: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
linux-amd64: | |
name: linux-amd64 | |
if: ${{ needs.next-version.outputs.version != ''}} | |
needs: ["next-version"] | |
runs-on: ubuntu-latest | |
env: | |
GOARCH: amd64 | |
GOOS: linux | |
steps: | |
- name: "Check out code into the Go module directory" | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- id: go | |
name: "Set up Go 1.21" | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- | |
name: create | |
run: | | |
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt | |
go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=v${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
path: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
windows-amd64: | |
name: windows-amd64 | |
if: ${{ needs.next-version.outputs.version != ''}} | |
needs: ["next-version"] | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION: ${{ steps.go.outputs.version }} | |
env: | |
GOARCH: amd64 | |
GOOS: windows | |
steps: | |
- name: "Check out code into the Go module directory" | |
uses: actions/checkout@v3 | |
- id: go | |
name: "Set up Go 1.21" | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: create | |
run: | | |
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt | |
go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc.exe -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc.exe | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
path: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip | |
docker: | |
name: "Release Docker image" | |
if: ${{ needs.next-version.outputs.version != ''}} | |
needs: ["next-version","darwin-amd64", "linux-386", "linux-amd64", "windows-amd64", "darwin-arm64"] | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION: ${{ needs.next-version.outputs.version }} | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
check-latest: true | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Generate AWS region file | |
run: | | |
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt | |
- name: Set up QEMU | |
if: ${{ needs.next-version.outputs.version != ''}} | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
if: ${{ needs.next-version.outputs.version != ''}} | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GHCR | |
if: ${{ needs.next-version.outputs.version != ''}} | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
if: ${{ needs.next-version.outputs.version != ''}} | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
build-args: VERSION=${{needs.next-version.outputs.version}} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{needs.next-version.outputs.version}} | |
release: | |
name: "Create a release" | |
needs: ["next-version", "darwin-amd64", "linux-386", "linux-amd64", "windows-amd64", "darwin-arm64", "docker"] | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION: ${{ needs.next-version.outputs.version != ''}} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- uses: actions/download-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-darwin-amd64.zip | |
path: ./ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-linux-386.zip | |
path: ./ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-darwin-arm64.zip | |
path: ./ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-linux-amd64.zip | |
path: ./ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-windows-amd64.zip | |
path: ./ | |
- name: "release" | |
run: | | |
npm ci | |
npx semantic-release |