artifacts #103
Workflow file for this run
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: artifacts | |
on: | |
workflow_dispatch | |
permissions: | |
contents: read | |
jobs: | |
upload_contracts: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 1 | |
- name: Create Artifact | |
run: | | |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
VERSION_TAG="${GITHUB_REF#refs/tags/v}" | |
else | |
VERSION_TAG=$(echo "${GITHUB_SHA:0:7}") | |
fi | |
ARTIFACT_NAME="contracts_${VERSION_TAG}.tar.gz" | |
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> ${GITHUB_ENV} | |
tar -czvf ${ARTIFACT_NAME} ./contracts | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: 'us-east-2' | |
- name: Upload Artifact to AWS S3 | |
run: | | |
aws s3 cp ${{ env.ARTIFACT_NAME }} s3://${{ secrets.AWS_S3_BUCKET }} | |
aws s3api put-object-tagging \ | |
--bucket ${{ secrets.AWS_S3_BUCKET }} \ | |
--key "${{ env.ARTIFACT_NAME }}" \ | |
--tagging 'TagSet=[{Key=AutoDelete,Value=true}]' | |
upload_binaries: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
module: [ external/geth ] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 1 | |
- name: Setup Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.work.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
check-latest: true | |
cache-dependency-path: go.work.sum | |
- name: Build Artifacts | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release --config=./${{ matrix.module }}/.goreleaser.yml --clean --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: 'us-east-2' | |
- name: Upload Artifacts to AWS S3 | |
run: | | |
find /tmp/dist -type f \( -name "*.gz" -o -name "*.txt" \) \ | |
-exec sh -c ' | |
file=$(basename "${1}") | |
echo "Uploading ${file} to S3..." | |
aws s3 cp "${1}" s3://${{ secrets.AWS_S3_BUCKET }}/ && | |
aws s3api put-object-tagging \ | |
--bucket ${{ secrets.AWS_S3_BUCKET }} \ | |
--key "${file}" \ | |
--tagging "TagSet=[{Key=AutoDelete,Value=true}]" | |
' _ {} \; |